pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: greg@turnstep.com
To: pgsql-sql@postgresql.org
Cc: terencek@isd.canberra.edu.au
Subject: Re: parse error for function def
Date: Thu, 17 Jul 2003 14:19:19 -0000
Message-ID: <c18dcb6ef4c84258e162e0069d993718@biglumber.com> (raw)
In-Reply-To: <3F167E9D.2090709@cts.canberra.edu.au>


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





view thread (5+ messages)  latest in thread

Message-ID: <c18dcb6ef4c84258e162e0069d993718@biglumber.com>
Permalink:  ../c18dcb6ef4c84258e162e0069d993718@biglumber.com/
Also on:    postgresql.org/message-id/c18dcb6ef4c84258e162e0069d993718@biglumber.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: greg@turnstep.com, terencek@isd.canberra.edu.au
  Subject: Re: parse error for function def
  In-Reply-To: <c18dcb6ef4c84258e162e0069d993718@biglumber.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox