X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3E0DF9DCA0C for ; Wed, 11 Jan 2006 14:55:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 47312-05 for ; Wed, 11 Jan 2006 14:55:42 -0400 (AST) X-Greylist: delayed 00:06:39.417887 by SQLgrey- Received: from qtm.net (mummra.qtm.net [216.163.32.14]) by postgresql.org (Postfix) with SMTP id 814939DCA10 for ; Wed, 11 Jan 2006 14:55:40 -0400 (AST) Received: (qmail 14995 invoked from network); 11 Jan 2006 18:47:53 -0000 Received: from unknown (HELO ?192.168.0.101?) (mur@216.163.42.222) by mummra.qtm.net with SMTP; 11 Jan 2006 18:47:53 -0000 Message-ID: <43C55316.60403@endpoint.com> Date: Wed, 11 Jan 2006 13:48:54 -0500 From: Jeff Boes Organization: End Point, Inc. User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: psql client: technique for applying default values to :variables? X-Enigmail-Version: 0.93.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200601/44 X-Sequence-Number: 23833 Stumped: is there any way to set up default values for psql variables within the .SQL file itself? Obviously, I can do something like: $ psql -f my_script -v MYVAR=${myvar:-mydefault} but I would prefer to have the value stored with the .SQL file, e.g. (if this actually worked): \set MYVAR COALESCE(:MYVAR,'mydefault') -- Jeffery Boes <>< jeff@endpoint.com