From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marc SCHAEFER <alphanet-postgresql-sql@alphanet.ch>
Cc: pgsql-sql@postgresql.org
Subject: Re: Some additional PostgreSQL questions
Date: Mon, 27 May 2002 16:06:10 -0400
Message-ID: <26961.1022529970@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.3.96.1020527161022.2878A-100000@defian.alphanet.ch>
References: <Pine.LNX.3.96.1020527161022.2878A-100000@defian.alphanet.ch>
Marc SCHAEFER <alphanet-postgresql-sql@alphanet.ch> writes:
> compta=> DELETE FROM ecriture WHERE id = 1;
> DELETE 0
> The funny thing is the DELETE not saying an error, but not deleting (which
> is good, but I would like an error).
Then make your trigger raise an error. Returning NULL out of the
trigger means "silently suppress this operation". There's not much
point in having the system report an error; it has no idea what the
error condition is, while the trigger presumably knows why it's unhappy
and so can give a useful error message.
> How can I defer the trigger call til the end of the transaction ?
AFAIK we don't currently have end-of-transaction triggers, only
end-of-statement triggers.
> EXECUTE ''INSERT INTO ecriture(libelle)''
> || '' SELECT ''
> || quote_ident($2 || ''.libelle'')
> || '' FROM ''
> || quote_ident($2)
> || '' ORDER BY ''
> || quote_ident($2 || ''.id'');
I think you want quote_ident($2) || ''.libelle'' and so forth.
What you'll get from that is "tablename.libelle", what you want
is "tablename".libelle, no?
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, alphanet-postgresql-sql@alphanet.ch
Subject: Re: Some additional PostgreSQL questions
In-Reply-To: <26961.1022529970@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox