Re: [SQL] statement-level trigger sample out there?

2007-11-29 Thread Gerardo Herzig
Alvaro Herrera wrote: Gerardo Herzig escribió: Stephen Cook wrote: I am curious (coming from a MS SQL Server background, I just started playing with PostgreSQL recently). What type of situation would warrant a statement-level trigger that can't access the old and new values? Witho

Re: [SQL] statement-level trigger sample out there?

2007-11-29 Thread Alvaro Herrera
Gerardo Herzig escribió: > Stephen Cook wrote: > >> I am curious (coming from a MS SQL Server background, I just started >> playing with PostgreSQL recently). >> >> What type of situation would warrant a statement-level trigger that can't >> access the old and new values? Without that access, is

Re: [SQL] statement-level trigger sample out there?

2007-11-29 Thread Gerardo Herzig
Stephen Cook wrote: I am curious (coming from a MS SQL Server background, I just started playing with PostgreSQL recently). What type of situation would warrant a statement-level trigger that can't access the old and new values? Without that access, isn't the only information you get is the

Re: [SQL] statement-level trigger sample out there?

2007-11-29 Thread Christian Kindler
SORRRY - have lost the subject :-) Hmmm deamn ... I have a realy big table (> 2'000'000 records). every second there are several inserts and updates. the thing is i need a last row reference depending on a foreing_key. something like this: id, foreign_key, last_id, value1, value1, date

[SQL]

2007-11-29 Thread Christian Kindler
Hmmm deamn ... I have a realy big table (> 2'000'000 records). every second there are several inserts and updates. the thing is i need a last row reference depending on a foreing_key. something like this: id, foreign_key, last_id, value1, value1, date >1<, 3,null, 12,

Re: [SQL] statement-level trigger sample out there?

2007-11-29 Thread Pavel Stehule
On 29/11/2007, Stephen Cook <[EMAIL PROTECTED]> wrote: > I am curious (coming from a MS SQL Server background, I just started > playing with PostgreSQL recently). yes, I belive. I was too. There are total different style of triggeres in Postgres. But If I can say, programming in Postgres is much m

Re: [SQL] statement-level trigger sample out there?

2007-11-29 Thread Stephen Cook
I am curious (coming from a MS SQL Server background, I just started playing with PostgreSQL recently). What type of situation would warrant a statement-level trigger that can't access the old and new values? Without that access, isn't the only information you get is the fact that an operatio

Re: [SQL] statement-level trigger sample out there?

2007-11-29 Thread Pavel Stehule
Hello You cannot to access to values in statement trigger. Postgres doesn't support it. Regards Pavel Stehule On 29/11/2007, Christian Kindler <[EMAIL PROTECTED]> wrote: > Hi > > Can anyone provide me a simple example of a statement-level trigger? Problem > is I do not know how to access the ol

[SQL] statement-level trigger sample out there?

2007-11-29 Thread Christian Kindler
Hi Can anyone provide me a simple example of a statement-level trigger? Problem is I do not know how to access the old.*, new.* values. Thanks Chris -- GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail --

Re: [SQL] NULLIF problem

2007-11-29 Thread Michael Glaesemann
On Nov 28, 2007, at 14:00 , Erik Jones wrote: Why not just: UPDATE table SET mytime=NULL WHERE mytime=''; If mytime is a timestamp field, it won't have any values ''. I believe the OP is updating mytime to a client-supplied value which is passing '' when it probably means NULL. Michael

Re: [SQL] NULLIF problem

2007-11-29 Thread Gera Mel Handumon
Thanks! On Nov 28, 2007 10:47 AM, Michael Glaesemann <[EMAIL PROTECTED]> wrote: > > On Nov 27, 2007, at 21:04 , Gera Mel Handumon wrote: > > > I encounter an error if i use NULLIF with timestamp with time zone. > > eq. dbtime=nullif(mytime,'') > > > > i want to null the value of field DBTIME if t