Re: [SQL] PL/pgSQL question

2008-02-14 Thread Milen A. Radev
Sebastian Ritter написа: Hi all, I have a question regarding functions. How can I return zero rows from a function whose return type is a table row? I did the following test and it did not work as expected: [...] CREATE OR REPLACE FUNCTION foobar(boolean) RETURNS SETOF x AS $_$ DECLARE

[SQL] PL/pgSQL question

2008-02-14 Thread Sebastian Ritter
Hi all, I have a question regarding functions. How can I return zero rows from a function whose return type is a table row? I did the following test and it did not work as expected: CREATE OR REPLACE FUNCTION fn_get_user (integer) RETURNS usertable AS ' DECLARE in_userid A

Re: [SQL] PL/pgSQL question

2003-02-02 Thread Josh Berkus
Jim, > Yes i'm aware this it is possible in 7.3 - can someone please confirm its > not possible in 7.2 or provide me with an example of how to go about it. It is sort of possible in 7.2, as a function can return a cursor to an interface language capable of handling cursors. However, implementa

Re: [SQL] pl/pgsql question

2002-12-18 Thread Tim Perdue
Josh Berkus wrote: Tim, That loop apparently does not find any matching rows, which would have been inserted just before this row was, inside the same transaction. It was successfully finding those rows before, when the trigger was AFTER INSERT. If I manually select those rows after the query

Re: [SQL] pl/pgsql question

2002-12-18 Thread Josh Berkus
Tim, > That loop apparently does not find any matching rows, which would > have been inserted just before this row was, inside the same > transaction. > > It was successfully finding those rows before, when the trigger was > AFTER INSERT. If I manually select those rows after the query is > commi

Re: [SQL] pl/pgsql question

2002-12-18 Thread Tim Perdue
Ludwig Lim wrote: Try changing the "AFTER" to "BEFORE" CREATE TRIGGER projtask_insert_depend_trig BEFORE... Changes made to the "NEW" will not be reflect in the AFTER trigger since, the row is already inserted. Thanks, however this seems to present a different problem now. FOR depe

Re: [SQL] pl/pgsql question

2002-12-17 Thread Ludwig Lim
--- Tim Perdue <[EMAIL PROTECTED]> wrote: > I have created a function in pl/pgsql to modify a > row before it gets put > into the database, but it seems my modification is > being ignored, and > the unmodified row is being inserted. > > I have confirmed with this RAISE EXCEPTION that my > "NEW"

Re: [SQL] pl/pgsql question

2002-12-17 Thread Tom Lane
Tim Perdue <[EMAIL PROTECTED]> writes: > I have created a function in pl/pgsql to modify a row before it gets put ^^^ > into the database, but it seems my modification is being ignored, and > the unmodified row is being inserted. > CREAT

[SQL] pl/pgsql question

2002-12-17 Thread Tim Perdue
I have created a function in pl/pgsql to modify a row before it gets put into the database, but it seems my modification is being ignored, and the unmodified row is being inserted. I have confirmed with this RAISE EXCEPTION that my "NEW" row is modified properly, however it is not being stored

[SQL] pl/pgsql question (functions)

2001-06-20 Thread Kristoff Bonne
Greetings, I am new to pl/pgsqm (I did some SQL programming at school, now 8 years ago so that part is rusty too ;-)) Anycase, I have a question concerning creating your own functions in pl/pgsql. This is my situation: I have two tables: - 'hosts': containing 'hostname' (primary key) and 'ip_a

[SQL] PL/pgsql question

2001-06-12 Thread Andrea Suisani
hi, i define a function using pgacces with pl/pgsql. it seems that the queries define in the function wasn't executed. if I try to excute the same queries from the psql everything, really, works fine. the body of the function is: --- Declare rec_struttura record;