Received: from tomts12-srv.bellnexxia.net (tomts12.bellnexxia.net [209.226.175.56]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g14LELl28455 for ; Mon, 4 Feb 2002 16:14:21 -0500 (EST) (envelope-from fbax@sympatico.ca) Received: from ACER ([65.94.210.8]) by tomts12-srv.bellnexxia.net (InterMail vM.4.01.03.16 201-229-121-116-20010115) with SMTP id <20020204211421.QVRA9396.tomts12-srv.bellnexxia.net@ACER>; Mon, 4 Feb 2002 16:14:21 -0500 Message-Id: <3.0.6.32.20020204161211.02c1b8d0@pop6.sympatico.ca> X-Sender: b1wudu74@pop6.sympatico.ca X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (32) Date: Mon, 04 Feb 2002 16:12:11 -0500 To: me@shanewright.co.uk From: Frank Bax Subject: Re: constants Cc: pgsql-php@postgresql.org In-Reply-To: <200202041400.g14E0oA11034@fullerruss.dsvr.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Archive-Number: 200202/16 X-Sequence-Number: 922 Try a pg function. http://www.postgresql.org/idocs/index.php?sql-createfunction.html CREATE FUNCTION one() RETURNS int4 AS 'SELECT 1 AS RESULT' LANGUAGE 'sql'; SELECT one() AS answer; answer -------- 1 If you are truly adventurous, you could create a 'constant' table and have the function take an argument, which is key to the table. Frank At 02:00 PM 2/4/02 +0000, Shane Wright wrote: >Hi > >This may be the wrong list to ask this, apologies if so :) > >Anyway, is there any way to define constants in PostgreSQL - my app has lots >of them at the PHP level, but it'd be nice to use them directly in the SQL >without overly complex query building. > >Something like this... > >DEFINE CONSTANT MYCONST = 4; > >SELECT * FROM mytable WHERE myfield=MYCONST; > > >Thanks > >-- >Shane > >---------------------------(end of broadcast)--------------------------- >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >