From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andro <andromede@gmail.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: leaving out paramTypes parameter
Date: Mon, 14 Aug 2006 11:23:22 -0400
Message-ID: <9625.1155569002@sss.pgh.pa.us> (raw)
In-Reply-To: <da7021e0608140638w4bc5a22ey4d358d649442c8f5@mail.gmail.com>
References: <da7021e0608140638w4bc5a22ey4d358d649442c8f5@mail.gmail.com>
Andro <andromede@gmail.com> writes:
> they both require "paramTypes" parameter, but documentation says "If
> paramTypes is NULL, or any particular element in the array is zero,
> the server assigns a data type to the parameter symbol in the same way
> it would do for an untyped literal string."
> How reliable is that? Can we really leave out this parameter anytime?
Like it says, you get the same results you would get from writing a
literal string 'foo' where the parameter symbol is. If you like,
you can force the type decision with a cast in the query text, eg
"SELECT ... WHERE x = $1::int8 ... "
In some ways this is better than using paramTypes because you don't
have to mess with numeric OIDs for data types.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: tgl@sss.pgh.pa.us, andromede@gmail.com
Subject: Re: leaving out paramTypes parameter
In-Reply-To: <9625.1155569002@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox