From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Andro <andromede(at)gmail(dot)com> |
Cc: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Re: leaving out paramTypes parameter |
Date: | 2006-08-14 15:23:22 |
Message-ID: | 9625.1155569002@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
Andro <andromede(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory Stark | 2006-08-17 00:34:58 | Re: PQoidValue - get last ID of primary key after INSERT - small |
Previous Message | Andro | 2006-08-14 13:38:23 | leaving out paramTypes parameter |