Re: [SQL] rename idx's with table; avoid confusing idx names?

2005-12-02 Thread Tom Lane
george young writes: > I put together a plpgsql function to rename a table and it's indexes > correspondingly[see below]. I would like to know: > Is there a more robust/portable/clear way to do this? > Is this a bad idea for some subtle reason? It won't work if the table and column names ar

[SQL] rename idx's with table; avoid confusing idx names?

2005-12-02 Thread george young
[PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1] After tearing out some hair over the following sequence of events: [a few weeks ago] alter table foo rename to old_foo; create table foo(); insert into foo select blahblahblah from old_foo; [today] cluster foo_pk

Re: [SQL] Just 1 in a series...

2005-12-02 Thread Mark Fenbers
You might find the "DISTINCT ON" syntax does just what you want --- see the "weather report" example on the SELECT reference page. It's not standard SQL though. This works! Thanks! What would have to be done if I needed a standard SQL solution? Mark ---(end of bro

Re: [SQL] Just 1 in a series...

2005-12-02 Thread Tom Lane
Mark Fenbers <[EMAIL PROTECTED]> writes: > ... However, I only want the first occurrence of a such a series (where the > event_id is the same), what SQL syntax should I use to do this? You might find the "DISTINCT ON" syntax does just what you want --- see the "weather report" example on the SEL

[SQL] Just 1 in a series...

2005-12-02 Thread Mark Fenbers
I currently have a working SQL that SELECTs all records whose 'river_stage' column exceeds the 'flood_stage' column. (Very simple -- no applause needed.) Typically, if I get one record, I get a consecutive series of them since rivers rise and fall in a continuous fashion, and usually respond

Re: [SQL] Sybase Connection_Property('number') equivalent in PostGre

2005-12-02 Thread Achilleus Mantzios
O Emil Rachovsky έγραψε στις Dec 2, 2005 : > > I am trying to find out the PostGre equivalent to > the Sybase function Connection_Property (which returns > the connection id, given the parameter 'number') ,but > without success so far. Can anyone tell me how to > retrieve the connection id in P

[SQL] Sybase Connection_Property('number') equivalent in PostGre ?

2005-12-02 Thread Emil Rachovsky
I am trying to find out the PostGre equivalent to the Sybase function Connection_Property (which returns the connection id, given the parameter 'number') ,but without success so far. Can anyone tell me how to retrieve the connection id in PostGre? Thanks in advance, Emil