Re: parse error for function def

Поиск
Список
Период
Сортировка
От greg@turnstep.com
Тема Re: parse error for function def
Дата
Msg-id c18dcb6ef4c84258e162e0069d993718@biglumber.com
обсуждение исходный текст
Ответ на parse error for function def  (Terence Kearns <terencek@isd.canberra.edu.au>)
Список pgsql-sql
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> I'm trying to create a function to use on a trigger to check reference 
> to views since pg does not support foreign keys referencing views.

Can you explain exactly what you are trying to do and why? You are getting 
the error because a SQL function does not RETURN, it must end with a 
SELECT statement. It also has no DECLARE, BEGIN, or END. You can either 
remove all of those or change the language to plpgsql. See:

http://www.postgresql.org/docs/7.3/static/xfunc-sql.html

In addition, you cannot (with SQL) use an argument as the tablename. You 
also probably want to use EXISTS, not "count..::bool".

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200307171005

-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iD8DBQE/Fq/7vJuQZxSWSsgRAj01AKCz9BA4aYrp8pnqWy8VHA4i3WGjtgCgjndA
yzNOE52VAvJBOEvilACSGvA=
=EcwZ
-----END PGP SIGNATURE-----




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

Предыдущее
От: "Viorel Dragomir"
Дата:
Сообщение: Re: Is it possible to connect to another database
Следующее
От: Dmitry Tkach
Дата:
Сообщение: Re: parse error for function def