Re: [SQL] finding UNIQUES in information_schema

2009-04-16 Thread Tom Lane
Gerardo Herzig writes: > Tom Lane wrote: >> No, they contain information about constraints, period. How did you >> create those indexes? If you made them via SQL-standard PRIMARY KEY or >> UNIQUE constraint syntax, they should show in the information_schema. >> Otherwise not. > Well, i just don

Re: [SQL] finding UNIQUES in information_schema

2009-04-16 Thread Gerardo Herzig
Tom Lane wrote: > Gerardo Herzig writes: >> Hi all. Im failing while trying to obtain some metainfo from >> information_schema. Acording to the docs, constraint_column_usage and >> key_column_usage views contains some information about constraints and >> indexes. > > No, they contain information

Re: [SQL] finding UNIQUES in information_schema

2009-04-16 Thread Tom Lane
Gerardo Herzig writes: > Hi all. Im failing while trying to obtain some metainfo from > information_schema. Acording to the docs, constraint_column_usage and > key_column_usage views contains some information about constraints and > indexes. No, they contain information about constraints, period.

Re: [SQL] how to set the value to the column

2009-04-16 Thread DM
never mind i got the answer. Thanks for looking into it. - deepak On Thu, Apr 16, 2009 at 12:00 PM, DM wrote: > Hi All, > > I have a table test with columns name and value > > test table > name > value > > It has around 500 rows. > > I added a new column id to the table, > > Table test > id, >

Re: [SQL] how to set the value to the column

2009-04-16 Thread Andreas Kretschmer
DM wrote: > Hi All, > > I have a table test with columns name and value > > test table > name > value > > It has around 500 rows. > > I added a new column id to the table, > > Table test > id, > name, > value > > I am not sure how to insert numbers to my column id (1-500). You can cr

[SQL] how to set the value to the column

2009-04-16 Thread DM
Hi All, I have a table test with columns name and value test table name value It has around 500 rows. I added a new column id to the table, Table test id, name, value I am not sure how to insert numbers to my column id (1-500). Thanks

[SQL] finding UNIQUES in information_schema

2009-04-16 Thread Gerardo Herzig
Hi all. Im failing while trying to obtain some metainfo from information_schema. Acording to the docs, constraint_column_usage and key_column_usage views contains some information about constraints and indexes. See: Table "public.almatnov" Column| Type

Re: [SQL] Ordering a name list and ignoring whitespace

2009-04-16 Thread Tom Lane
Mikel Lindsaar writes: > I'm trying to select a list of names in alphabetical order but > ignoring the whitespace. > So for example, the name "La Combe" should come after "Lace" but > before "Lacs..." FWIW, this would probably happen automatically if you were using a non-C locale. I'm not sure

Re[2]: [SQL] Need a script that bakes INSERT script from SELECT results

2009-04-16 Thread ShuA
-Original Message- From: John DeSoi To: ShuA Date: Thu, 16 Apr 2009 08:25:15 -0400 Subject: Re: [SQL] Need a script that bakes INSERT script from SELECT results > On Apr 16, 2009, at 7:29 AM, ShuA wrote: > > > Could someone post an example how to LOOP through row fields to wrap > > th

Re: [SQL] Need a script that bakes INSERT script from SELECT results

2009-04-16 Thread John DeSoi
On Apr 16, 2009, at 7:29 AM, ShuA wrote: Could someone post an example how to LOOP through row fields to wrap them into 'VALUES(...,,)' list? If you declare record or table row types, you can insert the values using (rec.*), something like this: create or replace function test () retur

[SQL] Need a script that bakes INSERT script from SELECT results

2009-04-16 Thread ShuA
I'm a novice to PL/pgSQL, and I'm curious, how to write function, that wraps SELECT results into INSERT script. The functionality I need is about to replicate table data into remote DB. I have tried dblink_build_insert(), but it requires primary key on tuple to create INSERT script from. I wou

Re: [SQL] Ordering a name list and ignoring whitespace

2009-04-16 Thread Mario Splivalo
Mikel Lindsaar wrote: Hi all, Doing some googling and looking through the docs, I can't find an obvious way to do this beside post processing after the query (which I am trying to avoid). I'm trying to select a list of names in alphabetical order but ignoring the whitespace. So for example, th

[SQL] Ordering a name list and ignoring whitespace

2009-04-16 Thread Mikel Lindsaar
Hi all, Doing some googling and looking through the docs, I can't find an obvious way to do this beside post processing after the query (which I am trying to avoid). I'm trying to select a list of names in alphabetical order but ignoring the whitespace. So for example, the name "La Combe" should

Re: [SQL] Re: SQL to Check whether "AN HOUR PERIOD" is between start and end timestamps

2009-04-16 Thread Andreas Joseph Krogh
On Saturday 11 April 2009 00:41:54 Jasen Betts wrote: > On 2009-04-02, Alvaro Herrera wrote: > > James Kitambara wrote: > >> Dear Srikanth, > >> You can solve your problem by doing this > >> > >> THE SQL IS AS FOLLOWS > >> ASSUME TIME INTERVAL 2008-12-07 07:59:59 TO 2008-12-07 08:58:59 AND THE