Re: parse error for function def

From: greg(at)turnstep(dot)com
To: pgsql-sql(at)postgresql(dot)org
Cc: terencek(at)isd(dot)canberra(dot)edu(dot)au
Subject: Re: parse error for function def
Date: 2003-07-17 14:19:19
Message-ID: c18dcb6ef4c84258e162e0069d993718@biglumber.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)turnstep(dot)com
PGP Key: 0x14964AC8 200307171005

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

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dmitry Tkach 2003-07-17 14:24:43 Re: parse error for function def
Previous Message Viorel Dragomir 2003-07-17 14:06:43 Re: Is it possible to connect to another database