Re: rules over multiple tables

From: "Henshall, Stuart - WCP" <SHenshall(at)westcountrypublications(dot)co(dot)uk>
To: 'Daniel Grob' <dgrob(at)gmx(dot)net>, pgsql-novice(at)postgresql(dot)org
Subject: Re: rules over multiple tables
Date: 2002-03-25 15:14:56
Message-ID: E2870D8CE1CCD311BAF50008C71EDE8E01F7483C@MAIL_EXCHANGE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,
<snip>
>
> ERROR: there is no built-in function named "
> declare
> "ID_ADDR" alias for $1;
> ...
> return 1;
> END;"
>
>
> See below the Syntax I used:
>
> create function
> delete_irgendwas_function (int4,varchar,...)
> returns boolean as '
> declare
> "ID_ADDR" alias for $1;
> "COMPANY" alias for $2;
> "SIGN" alias for $65;
I personally would try and avoid variables with quotes round them (not sure
if its even legal). Instead I'd do something like
f_id_addr alias for $1;

> begin
> delete from "ADDRESSES"
> where "ID_ADDR" = f_"ID_ADDR" AND "COMPANY" = f_"COMPANY"...;
Having variables named the same as fields can get confusing (for the parser
as well as people).
See above for how I personally would name

> delete from "CONTACTS"
> where "ID" = f_"ID" AND "C_CATEGORY" = f_"C_CATEGORY" AND
> .... "SIGN" =
> f_"SIGN";
> return 1;
> END;'
> LANGUAGE 'internal';
Should be LANGUAGE 'plpgsql';
Hope this helps,
- Stuart

Browse pgsql-novice by date

  From Date Subject
Next Message Brian Johnson 2002-03-25 19:24:12 Searching for all records but integer field is causing problems
Previous Message Daniel Grob 2002-03-25 15:05:49 Re: rules over multiple tables