pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedCREATE VIEW form stored in database?
5+ messages / 3 participants
[nested] [flat]
* CREATE VIEW form stored in database?
@ 2006-01-31 09:51 Mario Splivalo <mario.splivalo@mobart.hr>
0 siblings, 1 reply; 5+ messages in thread
From: Mario Splivalo @ 2006-01-31 09:51 UTC (permalink / raw)
To: pgsql-sql
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."
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: CREATE VIEW form stored in database?
@ 2006-01-31 12:30 Richard Huxton <dev@archonet.com>
parent: Mario Splivalo <mario.splivalo@mobart.hr>
0 siblings, 1 reply; 5+ messages in thread
From: Richard Huxton @ 2006-01-31 12:30 UTC (permalink / raw)
To: mario.splivalo@mobart.hr; +Cc: pgsql-sql
Mario Splivalo wrote:
> When I create a view, I like to define it like this (just representing
> the form here):
[snip]
> But, when I extracit it from postgres, it's somehow stored like this:
[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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: CREATE VIEW form stored in database?
@ 2006-01-31 13:53 Mario Splivalo <mario.splivalo@mobart.hr>
parent: Richard Huxton <dev@archonet.com>
0 siblings, 1 reply; 5+ messages in thread
From: Mario Splivalo @ 2006-01-31 13:53 UTC (permalink / raw)
To: Richard Huxton <dev@archonet.com>; +Cc: pgsql-sql
On Tue, 2006-01-31 at 12:30 +0000, Richard Huxton wrote:
> Mario Splivalo wrote:
> > When I create a view, I like to define it like this (just representing
> > the form here):
> [snip]
> > But, when I extracit it from postgres, it's somehow stored like this:
> [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.
>
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."
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: CREATE VIEW form stored in database?
@ 2006-01-31 14:53 George Weaver <gweaver@shaw.ca>
parent: Mario Splivalo <mario.splivalo@mobart.hr>
0 siblings, 1 reply; 5+ messages in thread
From: George Weaver @ 2006-01-31 14:53 UTC (permalink / raw)
To: mario.splivalo@mobart.hr; +Cc: pgsql-sql
----- 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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: CREATE VIEW form stored in database?
@ 2006-02-13 17:33 George Weaver <gweaver@shaw.ca>
parent: George Weaver <gweaver@shaw.ca>
0 siblings, 0 replies; 5+ messages in thread
From: George Weaver @ 2006-02-13 17:33 UTC (permalink / raw)
To: mario.splivalo@mobart.hr; +Cc: pgsql-sql
----- Original Message -----
From: "Mario Splivalo" <mario.splivalo@mobart.hr>
>> 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.
>>
>
> 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."
>
>
>
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2006-02-13 17:33 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-01-31 09:51 CREATE VIEW form stored in database? Mario Splivalo <mario.splivalo@mobart.hr>
2006-01-31 12:30 ` Richard Huxton <dev@archonet.com>
2006-01-31 13:53 ` Mario Splivalo <mario.splivalo@mobart.hr>
2006-01-31 14:53 ` George Weaver <gweaver@shaw.ca>
2006-02-13 17:33 ` George Weaver <gweaver@shaw.ca>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox