Re: trigger-procedure without plpgsql

From: Holger Krug <hkrug(at)rationalizer(dot)com>
To: Picrate <picrate(at)ibelgique(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: trigger-procedure without plpgsql
Date: 2002-02-01 14:00:40
Message-ID: 20020201150040.A1504@dev12.rationalizer.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Feb 01, 2002 at 02:24:41PM +0100, Picrate wrote:
> Hi all,

> I!m having a hard time getting out well with trigger-procedures
> without using plpgsql. I cannot put a hand on some documentation about
> writing procedures in LANGUAGE 'sql'. There must be some info
> somewhere, isn't it?

Everybody would have a hard time in this case. It's simply impossible
with plain SQL. Use PLPGSQL.

The docs you need are the chapters 20. and 23. of PostgreSQL
documentation.

> I am trying to make a procedure which can update a table as reaction
> to an insert into another table. For that, I need to get the id of the
> table to update but I can't get it in any way because I don't know how
> to call it. The "new.id_table_to_update" doesn't seem to be recognized
> (the "new" term into the 'sql' procedure doesn't seem to be the right
> syntax to reference it).

NEW works only in PLPGSQL not in SQL.

> I would like to use 'sql' language for that 'cause I don't see any
> interest in doing it with plpgsql if I can do it without it.

You cannot.

> If someone could help... or at least mention some place where to
> learn how to do this, I would be very glad.

Read the docs cited above or look under techdocs.postgresql.org, there
should be plenty examples.

--
Holger Krug
hkrug(at)rationalizer(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-02-01 14:45:39 Re: timestamp weirdness
Previous Message Johnson, Shaunn 2002-02-01 13:53:40 date functions