Re: rules over multiple tables

Поиск
Список
Период
Сортировка
От Henshall, Stuart - WCP
Тема Re: rules over multiple tables
Дата
Msg-id E2870D8CE1CCD311BAF50008C71EDE8E01F7483C@MAIL_EXCHANGE
обсуждение исходный текст
Ответ на rules over multiple tables  (Daniel Grob <dgrob@gmx.net>)
Список 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

В списке pgsql-novice по дате отправления:

Предыдущее
От: Daniel Grob
Дата:
Сообщение: Re: rules over multiple tables
Следующее
От: "Brian Johnson"
Дата:
Сообщение: Searching for all records but integer field is causing problems