-----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-----