Re: [SQL] handling error in a function

2002-12-18 Thread Christoph Haller
> > i made desperate efforts with handling errors in a function. > > I am using functions for encapsulating a few sql-statements. Please have a > look at this: > > CREATE FUNCTION sp_fdelce(int4) RETURNS int4 AS ' > DECLARE > id ALIAS FOR $1; > BEGIN >DELETE FROM f_ces WHERE fce_id = id; >

Re: [SQL] handling error in a function

2002-12-18 Thread Tomasz Myrta
Peter Gabriel wrote: When executing this and violating that constraint (i mustn't delete that row), the function aborts with "unknown error" and i have no way to return 0 or something like that. I am programming with PHP and PEAR, each time, the result set is an object of type error, the scrip

Re: [SQL] Dynamic sql program using libpq

2002-12-18 Thread Christoph Haller
> > I am able to find couple > of examples for dynamic sql programming through ecpg. But i want to > do dynamic sql programming through libpq. > If anyone has programs doing the dynamic sql programmming using the > libpq libraries please mail to me. > Attached you'll find my encapsulated library of

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

[SQL] Error code for database down

2002-12-18 Thread dnaren
HI... When i executed a query using PQexec..It returned error. Is there any way to check this error is because of Database is down. like PGRES_EMPTY_QUERY -- The string sent to the backend was empty. PGRES_COMMAND_OK -- Successful completion of a command returning no da

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

[SQL] references table(multiple columns go here)

2002-12-18 Thread Gary Stainburn
Hi folks, how do I define a referene from 2 columns in 1 table to 2 columns in another. I have: create table ranks ( rid int4 default nextval('ranks_rid_seq'::text) unique not null, rdidcharacter references depts(did), -- department rrank int4 not null,

Re: [SQL] references table(multiple columns go here)

2002-12-18 Thread Tomasz Myrta
Hello again Gary Stainburn wrote: Hi folks, how do I define a referene from 2 columns in 1 table to 2 columns in another. I have: create table ranks ( rid int4 default nextval('ranks_rid_seq'::text) unique not null, rdid character references depts(did), -- department rrank int4 not nu

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] references table(multiple columns go here)

2002-12-18 Thread Gary Stainburn
Hi Tomasz, On Wednesday 18 December 2002 4:46 pm, Tomasz Myrta wrote: > Hello again > > Gary Stainburn wrote: > > Hi folks, > > > > how do I define a referene from 2 columns in 1 table to 2 columns in > > another. > > > > I have: > > > > create table ranks ( > > rid int4 default nextval('r

[SQL] unsubscribe

2002-12-18 Thread Kristopher Yates
unsubscribe ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] references table(multiple columns go here)

2002-12-18 Thread Gary Stainburn
On Wednesday 18 December 2002 4:56 pm, Gary Stainburn wrote: > Hi Tomasz, [snip] > > > create table jobtypes ( > > > jid int4 default nextval('jobs_jid_seq'::text) unique not null, > > > jdid character references ranks(rdid), -- This joint reference > > > jrank

Re: [SQL] references table(multiple columns go here)

2002-12-18 Thread Tom Lane
Gary Stainburn <[EMAIL PROTECTED]> writes: > I've just tried this on a 7.2.1-5 system and get the same error. >> create table jobtypes ( >> jid int4 default nextval('jobs_jid_seq'::text) unique not null, >> jdid character, -- This joint reference >> jrank

Re: [SQL] references table(multiple columns go here)

2002-12-18 Thread Tomasz Myrta
Tom Lane wrote: Gary Stainburn writes: >I've just tried this on a 7.2.1-5 system and get the same error. >>create table jobtypes ( >>jid int4 default nextval('jobs_jid_seq'::text) unique not null, >>jdid character, -- This joint reference >>jrank int4 not null references ranks(rrank),