placeholder syntax

From: Abhijit Menon-Sen <ams(at)wiw(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: placeholder syntax
Date: 2004-06-21 12:26:25
Message-ID: 20040621175625.A32084@lustre.dyn.wiw.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

PostgreSQL currently uses $1/$2 for placeholders in prepared statements.
I'm writing something that may potentially submit queries to both Oracle
and Postgres, and it seems Oracle doesn't accept this syntax. Someone on
IRC said I could use ? for both Oracle and Postgres. It isn't entirely
clear to me if Oracle accepts it, but Postgres doesn't seem to.

My copy of the SQL92 standard says:

«In SQL-statements that are executed dynamically, the parameters are
called dynamic parameters (<dynamic parameter specification>s) and
are represented in SQL language by a <question mark> (?).»

(There's also an "<embedded variable name>" production in the standard,
which looks like the :foo syntax that Oracle also accepts, but I'm not
sure it applies to placeholders. The standard is a bit hard to read.)

Should Postgres accept ? as a placeholder?

(If so, I'll dig around and try to figure out how to make it do so.)

-- ams

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-06-21 14:32:31 Re: placeholder syntax
Previous Message Christopher Kings-Lynne 2004-06-21 10:45:53 Stuff I'm working on