Numerical variables in pqsql statements - Mailing list pgsql-sql

From Michael Schmidt
Subject Numerical variables in pqsql statements
Date
Msg-id BAY101-DAV8EA3AA3EF2A17C6F7C9EEA3B60@phx.gbl
Whole thread Raw
Responses Re: Numerical variables in pqsql statements  ("Thomas F. O'Connell" <tfo@sitening.com>)
List pgsql-sql
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
      SELECT ra.ref_auth_key, a.last_name, a.first_name
      FROM ref_auth ra INNER JOIN authors a
      ON (ra.author_num = a.author_key)
      WHERE ra.ref_num = 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.

pgsql-sql by date:

Previous
From: Chris Mungall
Date:
Subject: Common patterns for 'store' functions
Next
From: "Matt A."
Date:
Subject: question