[SQL] EXECUTE with a prepared plan and NULL

2009-01-04 Thread sergey kapustin
Hello! I'm trying to run this code in one of my stored procedures s := 'execute prepared_plan( ' || id_engine || ',' || id_search || ',' || id_rsite || ')'; execute s; where "prepared_plan" is a statement defined before with PREPARE. The thing is, that if i one of the parameters is NULL, then

Re: [SQL] How to excute dynamically a generated SQL command?

2009-01-04 Thread Adrian Klaver
On Saturday 03 January 2009 5:57:32 pm John Zhang wrote: > Hi the list, > > Referring to the PostgreSQL 8.3 documentation " 38.5.4. Executing Dynamic > Commands ", the command for executing a dynamic command is: > EXECUTE command-string [ INTO [STRICT] target ]; > > > I am to execute an sql stateme

Re: [SQL] EXECUTE with a prepared plan and NULL

2009-01-04 Thread Tom Lane
"sergey kapustin" writes: > The thing is, that if i one of the parameters is NULL, then string s becomes > NULL also ( because NULL||"any string" = NULL) and as a result i get this > error - > ERROR: cannot EXECUTE a null querystring quote_nullable() might help. regards,