|
Home > Archive > PostgreSQL SQL > February 2006 > CREATE VIEW form stored in database?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
CREATE VIEW form stored in database?
|
|
| Mario Splivalo 2006-01-31, 7:24 am |
| When I create a view, I like to define it like this (just representing
the form here):
CREATE VIEW vw_my_view
AS
SELECT
t1.col1,
t2.col2
FROM
t1
JOIN t2
ON t1.col1 = t2.col3
WHERE
t2.col4 = 'bla'
But, when I extracit it from postgres, it's somehow stored like this:
CREATE VIEW vw_my_view
AS
SELECT t1.col1, t2.col2
FROM t1
JOIN t2 ON t1.col1 = t2.col3
WHERE t2.col4 = 'bla'
The later is much more hard to read, and when I need to change the view,
i get rash and stuff :)
Is there a way to tell postgres NOT to format the 'source code' of my
views?
Mike
--
Mario Splivalo
Mob-Art
mario.splivalo@mobart.hr
"I can do it quick, I can do it cheap, I can do it well. Pick any two."
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly
| |
| Richard Huxton 2006-01-31, 7:24 am |
| Mario Splivalo wrote:
> When I create a view, I like to define it like this (just representing
> the form here):
& #91;snip]
> But, when I extracit it from postgres, it's somehow stored like this:
& #91;snip]
> The later is much more hard to read, and when I need to change the view,
> i get rash and stuff :)
>
> Is there a way to tell postgres NOT to format the 'source code' of my
> views?
I don't think it stores the "source code", but rather the structure of
the underlying query. So I'm afraid you lose the spacing.
I keep all my definitions in a set of files and read in updates with \i
my_filename.sql from psql. That lets me keep all my spaces and comments.
--
Richard Huxton
Archonet Ltd
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
| |
| Mario Splivalo 2006-01-31, 9:24 am |
| On Tue, 2006-01-31 at 12:30 +0000, Richard Huxton wrote:
> Mario Splivalo wrote:
> [snip]
> [snip]
>
> I don't think it stores the "source code", but rather the structure of
> the underlying query. So I'm afraid you lose the spacing.
>
> I keep all my definitions in a set of files and read in updates with \i
> my_filename.sql from psql. That lets me keep all my spaces and comments.
>
Yes, I'm tied to the pgadmin3 for the moment, so there's nothing I could
do. It's a pain to develop a database such way.
Mike
--
Mario Splivalo
Mob-Art
mario.splivalo@mobart.hr
"I can do it quick, I can do it cheap, I can do it well. Pick any two."
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
| |
| George Weaver 2006-01-31, 9:24 am |
|
----- Original Message -----
From: "Mario Splivalo" <mario.splivalo@mobart.hr>
>
> Yes, I'm tied to the pgadmin3 for the moment, so there's nothing I could
> do. It's a pain to develop a database such way.
Mario,
If you keep your definition in a script file, you can copy the script and
paste it into pgAdmin's Execute Arbitrary SQL Queries window, and then
execute the script from there.
Regards,
George
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend
| |
| George Weaver 2006-02-13, 1:24 pm |
|
----- Original Message -----
From: "Mario Splivalo" <mario.splivalo@mobart.hr>
>
> It's still a pain. If I have two dozen views, it takes too much time :)
You also have the option of loading script files in the Execute Arbitray SQL
Queries window (File > Open, etc.). Thus you could put all your views into
one script file, load the file, and then execute the query.
>
> Mario
> --
> Mario Splivalo
> Mob-Art
> mario.splivalo@mobart.hr
>
> "I can do it quick, I can do it cheap, I can do it well. Pick any two."
>
>
>
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org
|
|
|
|
|