Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id BB19A9F954C for ; Mon, 3 Sep 2007 18:59:15 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 18292-01 for ; Mon, 3 Sep 2007 18:59:09 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from web54306.mail.re2.yahoo.com (web54306.mail.re2.yahoo.com [206.190.49.116]) by postgresql.org (Postfix) with SMTP id 99B419F9547 for ; Mon, 3 Sep 2007 18:59:14 -0300 (ADT) Received: (qmail 75470 invoked by uid 60001); 3 Sep 2007 21:59:11 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=OvIDoZSE/dMjAuqhFrZWo+4rBh9GEU9Y1Hnsdff7KyzbN0UF/GTZ6Rlp5e9MUMYasYP7qG++mtbDNcsKq7c9yl/TiZ/NfLorDIOHsKJ+nToDpomKKwi/eJMB4Oik+GnD7dFudJxqmjSVffGz+z194o6LdWPlqUclt0hFmGr5V6g=; X-YMail-OSG: xdz9Xa0VM1lXAVbh3ExMvxGq4wVKDAh2IwaV9ayo2bOnan2v7p.P9_nrc2Eu4TuNbzSmQdJCV6h4BRGWOJ9IYa2fnupf6L5uldbDS2x3nLUAtHj2QVADU1d_UoSn0w-- Received: from [69.108.235.25] by web54306.mail.re2.yahoo.com via HTTP; Mon, 03 Sep 2007 14:59:11 PDT Date: Mon, 3 Sep 2007 14:59:11 -0700 (PDT) From: chester c young Subject: Re: Execute SQL statements with 'context'/predefined variables To: blay bloo Cc: sql pgsql In-Reply-To: <66c468170709031102j1e21d313v512c488ccc289505@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <692669.75275.qm@web54306.mail.re2.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/13 X-Sequence-Number: 29226 > I was wondering if it is possible to set the 'context' for running an > sql command Oracle has a Context('varname') that returns the value of varname for the session. to best of my knowledge pg has nothing like this. > I guess bottom line, is it possible to execute a bunch of SQL > statements with some predefined variables? you could use rules to inject you constants as long as you were dealing with known tables/views; you'd have to rewrite the rules each time the constants changed; the rules are not session oriented - each sessions would use the same rule. (if you have not used pg rules imho you are in for a very pleasant surprise.) ____________________________________________________________________________________ Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz