Re: Some additional PostgreSQL questions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Some additional PostgreSQL questions
Дата
Msg-id 26961.1022529970@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Some additional PostgreSQL questions  (Marc SCHAEFER <alphanet-postgresql-sql@alphanet.ch>)
Список pgsql-sql
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


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: Re: Trees in SQL
Следующее
От: "Julian Scarfe"
Дата:
Сообщение: XSD to Postgresql SQL