Re: [SQL] polymorphic function in 7.4 vs. 8.3

2009-06-11 Thread Rob Sargent
Richard Rosenberg wrote: On Thursday 11 June 2009 14:49:46 Tom Lane wrote: Sure you can't move the DB off 7.4? There would be pretty considerable benefits from adopting some recent release instead. regards, tom lane Don't I know it. I am SOL as the machine is

Re: [SQL] polymorphic function in 7.4 vs. 8.3

2009-06-11 Thread Richard Rosenberg
On Thursday 11 June 2009 14:49:46 Tom Lane wrote: > Sure you can't move the DB off 7.4? There would be pretty considerable > benefits from adopting some recent release instead. > > regards, tom lane Don't I know it. I am SOL as the machine is hosted/shared out by an externa

Re: [SQL] polymorphic function in 7.4 vs. 8.3

2009-06-11 Thread Richard Rosenberg
Tom, thanks for your prompt reply. I think I may have my head on straight now, this should work: CREATE TABLE atest1 (   id integer NOT NULL,   descr text,   CONSTRAINT atest1_pkey PRIMARY KEY (id) ); CREATE OR REPLACE FUNCTION test1_trg()   RETURNS trigger AS ' DECLARE     some_rec public.ates

Re: [SQL] polymorphic function in 7.4 vs. 8.3

2009-06-11 Thread Tom Lane
Richard Rosenberg writes: > Tom, thanks for your prompt reply. I think I may have my head on straight > now, > this should work: Yeah, but you're still out of luck on 7.4. Its plpgsql doesn't have any ability to pass whole-row variables into expressions. I don't see any answer for you except

Re: [SQL] polymorphic function in 7.4 vs. 8.3

2009-06-11 Thread Tom Lane
Richard Rosenberg writes: > I have the following setup which works great in version 8.3 but throws an > error in 7.4: I think you mangled your example to the point where it doesn't work in 8.3 either ... I get ERROR: a column definition list is required for functions returning "record" CONTEXT

[SQL] polymorphic function in 7.4 vs. 8.3

2009-06-11 Thread Richard Rosenberg
I have the following setup which works great in version 8.3 but throws an error in 7.4: CREATE TABLE atest1 ( id integer NOT NULL, descr text, CONSTRAINT atest1_pkey PRIMARY KEY (id) ); CREATE OR REPLACE FUNCTION test_trg() RETURNS "trigger" AS ' DECLARE any_rec wfsys.atest1;

Re: [SQL] Avoiding "will create implicit index" NOTICE

2009-06-11 Thread Rob Sargent
A. Kretschmer wrote: In response to Bryce Nesbitt : Hmm, no. I still get the NOTICE. How can I create the primary key without triggering a NOTICE? Sure, set client_min_messages='...' test=*# create table bla(id int primary key); NOTICE: CREATE TABLE / PRIMARY KEY will create implici

Re: [SQL] dynamic columns in a query

2009-06-11 Thread Pavel Stehule
Hello 2009/6/11 Jyoti Seth : > Hi All, > > Is there any way in postgres to write a query to display the result in > matrix form. (where column names are dynamic) > look on http://okbob.blogspot.com/2008/08/using-cursors-for-generating-cross.html regards Pavel Stehule > For eg. > > > Employee N

Re: [SQL] dynamic columns in a query

2009-06-11 Thread A. Kretschmer
In response to Jyoti Seth : > Hi All, > > Is there any way in postgres to write a query to display the result in > matrix form. (where column names are dynamic) > > For eg. > > > Employee Name Client1 Client2 Client3 Client4 > Emp1 100 102 90

[SQL] dynamic columns in a query

2009-06-11 Thread Jyoti Seth
Hi All, Is there any way in postgres to write a query to display the result in matrix form. (where column names are dynamic) For eg. Employee Name Client1 Client2 Client3 Client4 Emp1100 102 90 23 Emp256

Re: [SQL] Avoiding "will create implicit index" NOTICE

2009-06-11 Thread A. Kretschmer
In response to Bryce Nesbitt : > Hmm, no. I still get the NOTICE. How can I create the primary key > without triggering a NOTICE? Sure, set client_min_messages='...' test=*# create table bla(id int primary key); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "bla_pkey" for table

Re: [SQL] Avoiding "will create implicit index" NOTICE

2009-06-11 Thread Bryce Nesbitt
Hmm, no. I still get the NOTICE. How can I create the primary key without triggering a NOTICE? bnesbitt=> create unique index test_5_pkey on test_5 (userid, site_key); CREATE INDEX bnesbitt=> alter table test_5 add primary key (userid, site_key); NOTICE: ALTER TABLE / ADD PRIMARY KEY will crea