From: | "Michael Schmidt" <MichaelMSchmidt(at)msn(dot)com> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Numerical variables in pqsql statements |
Date: | 2005-08-22 00:43:33 |
Message-ID: | BAY101-DAV8EA3AA3EF2A17C6F7C9EEA3B60@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin 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.
From | Date | Subject | |
---|---|---|---|
Next Message | John DeSoi | 2005-08-22 01:43:55 | Re: sleep? |
Previous Message | Michael Fuhr | 2005-08-21 22:41:33 | Re: sleep? |
From | Date | Subject | |
---|---|---|---|
Next Message | Roger Tannous | 2005-08-22 10:23:29 | Re: A Table's Primary Key Listing |
Previous Message | Matt A. | 2005-08-21 19:56:27 | returning inserted id |