Re: Assignments in PL/pgSQL - Mailing list pgsql-sql

From Josh Berkus
Subject Re: Assignments in PL/pgSQL
Date
Msg-id 200209131051.41556.josh@agliodbs.com
Whole thread Raw
In response to Assignments in PL/pgSQL  ("Michael Paesold" <mpaesold@gmx.at>)
List pgsql-sql
Michael,

> although this is not really SQL, but PL/pgSQL, I hope this is the right
> place to ask.

This is the right place.

> I have written a complex triggers. It works very well. Just now I have
> realized that I have used the = operater for variable assignments, instead
> of the := operater. To my suprise, there was no error or warning, and the
> store procedure works very well!
>
> e.g.
> NEW.someval = rec.someother;
> works as well as
> NEW.someval := rec.someother;
>
> Can you confirm that both are valid? Can someone explain this?
> And is it safe to use the former syntax?

I'm very surprised, too.   The "=" syntax is not per spec; my guess is,
somebody coded in compatibility for DB conversion purposes and left it there.
Jan?  Tom?

--
-Josh BerkusAglio Database SolutionsSan Francisco



pgsql-sql by date:

Previous
From: Andrew Perrin
Date:
Subject: Re: LIMIT within UNION?
Next
From: Joe Conway
Date:
Subject: Re: Assignments in PL/pgSQL