Re: [SQL] Dynamic prepare possible in plpgsql?

2007-04-30 Thread Tom Lane
"Collin Peters" <[EMAIL PROTECTED]> writes: > Is it possible to have a dynamic PREPARE statement in plpgsql? Well, you could use plpgsql's EXECUTE to run SQL PREPARE and EXECUTE commands, but it seems awfully brute-force. What do you really need to accomplish here? regard

Re: [SQL] "is not distinct from" syntax error?

2007-04-30 Thread Tom Lane
"Collin Peters" <[EMAIL PROTECTED]> writes: > However, when I do: > SELECT1 IS NOT DISTINCT FROM 2 > I get "ERROR: syntax error at or near "DISTINCT"" > What is the problem here? Using a pre-8.2 server, likely. regards, tom lane ---(end of

[SQL] "is not distinct from" syntax error?

2007-04-30 Thread Collin Peters
From: http://www.postgresql.org/docs/8.2/static/functions-comparison.html " The ordinary comparison operators yield null (signifying "unknown") when either input is null. Another way to do comparisons is with the IS [ NOT ] DISTINCT FROM construct: expression IS DISTINCT FROM expression expressi

[SQL] Dynamic prepare possible in plpgsql?

2007-04-30 Thread Collin Peters
Is it possible to have a dynamic PREPARE statement in plpgsql? Something like PREPARE users_plan ( || 'text, text' || ) AS INSERT INTO pp_users( || 'col1, col2' || ) VALUES($1, $2); Regards, Collin ---(end of broadcast)---

[SQL] NEW to plpythonu function?

2007-04-30 Thread David Flegl
Hi, may anyone help me with problem how to passed trigger row NEW from trigger function in plpgsql to other support function in plpythonu? I've tried something like> CREATE FUNCTION pythfce(arg record)... CREATE FUNCTION pythfce(arg anyelement)... but now effect. I'm getting system messages

[SQL] Recursive query for Product Tree

2007-04-30 Thread devil live
I have product tree for a product product_tree table : product_code, stock_code, amount_ratio 152.001.001, 151.001.001, 1 152.001.001, 150.001.001, 2 151.001.001 150.003.003, 3 151.001.001 150.009.001, 1 I need to write a query with result: 152.001.001, 150.003.003, 1 152.001.001, 150.