Re: Assignments in PL/pgSQL

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: josh(at)agliodbs(dot)com
Cc: Michael Paesold <mpaesold(at)gmx(dot)at>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Assignments in PL/pgSQL
Date: 2002-09-13 18:04:35
Message-ID: 3D8228B3.6262C2C7@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Josh Berkus wrote:
>
> 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?

Er ... I don't recall completely, maybe it was more compatibility
to my own lazyness ;-/ (typing a colon means Shift-and-semicolon
... that's 2 saved keystrokes per assignment ... what do you
think where I save all the keystrokes I need to write email like
this?).

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being
right. #
# Let's break this rule - forgive
me. #
#==================================================
JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Joe Conway 2002-09-13 18:04:57 Re: Assignments in PL/pgSQL
Previous Message Josh Berkus 2002-09-13 17:51:41 Re: Assignments in PL/pgSQL