X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 31DB3D725F for ; Sun, 21 Aug 2005 21:43:34 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20118-02 for ; Mon, 22 Aug 2005 00:43:31 +0000 (GMT) Received: from hotmail.com (bay101-dav8.bay101.hotmail.com [64.4.56.80]) by svr1.postgresql.org (Postfix) with ESMTP id 3E350D7215 for ; Sun, 21 Aug 2005 21:43:30 -0300 (ADT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun, 21 Aug 2005 17:43:34 -0700 Message-ID: Received: from 64.4.56.204 by BAY101-DAV8.phx.gbl with DAV; Mon, 22 Aug 2005 00:43:34 +0000 X-Originating-IP: [64.4.56.204] X-Originating-Email: [michaelmschmidt@msn.com] X-Sender: michaelmschmidt@msn.com From: "Michael Schmidt" To: Subject: Numerical variables in pqsql statements Date: Sun, 21 Aug 2005 18:43:33 -0600 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0004_01C5A680.3BBE5040" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: MSN 9 X-MimeOLE: Produced By MSN MimeOLE V9.10.0011.1703 Seal-Send-Time: Sun, 21 Aug 2005 18:43:33 -0600 X-OriginalArrivalTime: 22 Aug 2005 00:43:34.0486 (UTC) FILETIME=[86BD2760:01C5A6B2] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.43 required=5 tests=[AWL=-0.416, DNS_FROM_RFC_ABUSE=0.374, DNS_FROM_RFC_POST=1.376, HTML_50_60=0.095, HTML_MESSAGE=0.001, MSGID_FROM_MTA_HEADER=0] X-Spam-Level: * X-Archive-Number: 200508/253 X-Sequence-Number: 22481 This is a multi-part message in MIME format. ------=_NextPart_000_0004_01C5A680.3BBE5040 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Folks, I'm sure this is dumb, but I'm a little confused about use of numerical = variables in pqsql. It was my impression one had to use EXECUTE on a = concatenated string including quote_literal() for the variable = containing the value. This can be quite a bit of trouble. I just wrote = a function that included the statement : CREATE TEMPORARY TABLE author_names AS=20 SELECT ra.ref_auth_key, a.last_name, a.first_name=20 FROM ref_auth ra INNER JOIN authors a ON (ra.author_num =3D a.author_key)=20 WHERE ra.ref_num =3D refer_num; where refer_num is integer. This worked (surprisingly, to me). So, = what is the rule regarding variables? Would this query work if I = concatenated a string together, including quote_literal(refer_num) and = then EXECUTEd it? Thanks and sorry to be so stupid. ------=_NextPart_000_0004_01C5A680.3BBE5040 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Folks,
I'm sure this is dumb, but I'm a little confused about use of = numerical=20 variables in pqsql.  It was my impression one had to use EXECUTE on = a=20 concatenated string including quote_literal() for the variable = containing the=20 value.  This can be quite a bit of trouble.  I just wrote a=20 function that included the statement :
 
CREATE TEMPORARY TABLE author_names AS =
     =20 SELECT ra.ref_auth_key, a.last_name, a.first_name=20
      FROM ref_auth ra INNER JOIN authors=20 a
      ON (ra.author_num =3D a.author_key)=20
      WHERE ra.ref_num =3D refer_num;
 
where refer_num is integer.  This worked (surprisingly, to = me). =20 So, what is the rule regarding variables?  Would this query work if = I=20 concatenated a string together, including quote_literal(refer_num) and = then=20 EXECUTEd it?
 
Thanks and sorry to be so stupid.
------=_NextPart_000_0004_01C5A680.3BBE5040--