Re: [SQL] rewriting values with before trigger

Поиск
Список
Период
Сортировка
От Robert Treat
Тема Re: [SQL] rewriting values with before trigger
Дата
Msg-id 200304250003.24506.xzilla@users.sourceforge.net
обсуждение исходный текст
Ответ на Re: [SQL] rewriting values with before trigger  (elein <elein@sbcglobal.net>)
Ответы Re: [SQL] rewriting values with before trigger  (Josh Berkus <josh@agliodbs.com>)
Re: [SQL] rewriting values with before trigger  (elein <elein@sbcglobal.net>)
Список pgsql-general
On Thursday 24 April 2003 08:28 pm, elein wrote:
> I don't think this is a bug at all.
> Argument creation has to come before the execution
> of the function.  That in this case the argument is a row type
> doesn't matter.  It has nothing to do with the content of the
> function and everything to do with creating the row NEW.
> How can you possibly assign a value to NEW.bar if NEW as
> a whole does not exist?
>

You misunderstood. I don't think it's a bug in postgresql,  it's a bug in the
application that is hitting against my database. When it doesn't have a value
for the timestamp field, it either needs to drop it from the insert statment
or convert it to null; not send a ''

> What are you really trying to do here?  Maybe setting the
> table column's default to NULL will achieve what you want.
>

I have an application that is inserting information into a table periodically.
Sometimes it passes in timestamps for certain fields, but sometimes it
doesn't have any timestamp information. When it doesn't have information, it
should send NULL. Unfortunatly the app writers wrote it to send ''. Default's
don't work because the app is trying to post data, it's just not a valid
datatype.  Luckily in this instance I can tell the app guys they have to fix
thier app instead of having to muck up the database.

Robert Treat


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Factoring where clauses through UNIONS take 2
Следующее
От: Együd Csaba
Дата:
Сообщение: Returning with a userd defined type (PL/pgSQL)