[GENERAL] syntax error during function call

2010-01-27 Thread Aycock, Jeff R.
Hello, I have a function with three parameters that would populate a table in one schema from another table of the same name in another schema. The tables are dynamically selected at execution time. CREATE OR REPLACE FUNCTION schema_1.getAllSnapShot(user_id text, begin_dt date, end_dt

Re: [GENERAL] syntax error during function call

2010-01-27 Thread Raymond O'Donnell
On 27/01/2010 15:40, Aycock, Jeff R. wrote: BEGIN FOR r IN SELECT * FROM schema_1.snapshot_table LOOP DECLARE whoami text := r; I could be wrong, but I don't think that the DECLARE inside the loop is correct. I think you have to declare whoami with the rest of

Re: [GENERAL] syntax error during function call

2010-01-27 Thread Aycock, Jeff R.
To: Aycock, Jeff R. Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] syntax error during function call On 27/01/2010 15:40, Aycock, Jeff R. wrote: BEGIN FOR r IN SELECT * FROM schema_1.snapshot_table LOOP DECLARE whoami text := r; I could be wrong, but I

Re: [GENERAL] syntax error during function call

2010-01-27 Thread Pavel Stehule
ERROR:  syntax error at or near ( LINE 1: SELECT *, $1, now() INTO schema_1.(table_A) FROM schema_2.(table_A) where created_dt between $2 and $3; schema_1.(table_A) is nonsense. have to be schema_1.table_A regards Pavel Stehule -- Sent via pgsql-general mailing list

Re: [GENERAL] syntax error during function call

2010-01-27 Thread Aycock, Jeff R.
here though. Thanks for the suggestion, however. Regards, Jeff Aycock -Original Message- From: Pavel Stehule [mailto:pavel.steh...@gmail.com] Sent: Wednesday, January 27, 2010 11:13 AM To: Aycock, Jeff R. Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] syntax error during

Re: [GENERAL] syntax error during function call

2010-01-27 Thread Adrian Klaver
On 01/27/2010 08:27 AM, Aycock, Jeff R. wrote: Pavel, Per your suggestion I modified one line below BEGIN to look like this: EXECUTE 'SELECT *, $1, now() INTO schema_1.'||whoami||' FROM schema_2.'||whoami||' where created_dt between $2 and $3;' However, it is still giving me the same syntax

Re: [GENERAL] syntax error during function call

2010-01-27 Thread Andreas Kretschmer
Aycock, Jeff R. jeff.r.ayc...@saic.com wrote: Pavel, Per your suggestion I modified one line below BEGIN to look like this: EXECUTE 'SELECT *, $1, now() INTO schema_1.'||whoami||' FROM schema_2.'||whoami||' where created_dt between $2 and $3;'

Re: [GENERAL] syntax error during function call

2010-01-27 Thread Aycock, Jeff R.
] syntax error during function call On 01/27/2010 08:27 AM, Aycock, Jeff R. wrote: Pavel, Per your suggestion I modified one line below BEGIN to look like this: EXECUTE 'SELECT *, $1, now() INTO schema_1.'||whoami||' FROM schema_2.'||whoami||' where created_dt between $2 and $3;' However

Re: [GENERAL] syntax error during function call

2010-01-27 Thread Adrian Klaver
On 01/27/2010 08:41 AM, Aycock, Jeff R. wrote: Adrian, I tried that as well and got the same error result. Regards, Jeff Aycock I went back to the original function and assuming no cut/paste errors there is a ';' missing after the last END. END; RETURN NEXT r;

Re: [GENERAL] syntax error during function call

2010-01-27 Thread Aycock, Jeff R.
Thanks for the catch. However, this did not fix the syntax error. -Original Message- From: Adrian Klaver [mailto:adrian.kla...@gmail.com] Sent: Wednesday, January 27, 2010 11:47 AM To: Aycock, Jeff R. Cc: Pavel Stehule; pgsql-general@postgresql.org Subject: Re: [GENERAL] syntax error

Re: [GENERAL] syntax error during function call

2010-01-27 Thread Adrian Klaver
On 01/27/2010 08:50 AM, Aycock, Jeff R. wrote: Thanks for the catch. However, this did not fix the syntax error. You are sure the function is being replaced with versions that have the changes? In other words does \df+ show the changes? -- Adrian Klaver adrian.kla...@gmail.com -- Sent

Re: [GENERAL] syntax error during function call

2010-01-27 Thread Adrian Klaver
On 01/27/2010 08:50 AM, Aycock, Jeff R. wrote: Thanks for the catch. However, this did not fix the syntax error. Looking back at this thread I second Andreas's suggestion. It seems the syntax is right but the names are wrong. What is the result when you do SELECT * FROM

Re: [GENERAL] syntax error during function call

2010-01-27 Thread Sam Mason
On Wed, Jan 27, 2010 at 10:40:17AM -0500, Aycock, Jeff R. wrote: EXECUTE 'SELECT *, $1, now() INTO schema_1.'||whoami||' FROM schema_2.'||whoami||' where created_dt between $2 and $3;' You'll also need to expand those other parameters. The code is executed in an independent scope and hence PG

Re: [GENERAL] syntax error during function call

2010-01-27 Thread Aycock, Jeff R.
- From: Osvaldo Kussama [mailto:osvaldo.kuss...@gmail.com] Sent: Wednesday, January 27, 2010 11:57 AM To: Aycock, Jeff R. Subject: Re: [GENERAL] syntax error during function call 2010/1/27 Aycock, Jeff R. jeff.r.ayc...@saic.com: Hello, I have a function with three parameters that would