pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedPQexecParams and types
4+ messages / 2 participants
[nested] [flat]
* PQexecParams and types
@ 2004-02-03 07:25 Czuczy Gergely <phoemix@harmless.hu>
0 siblings, 1 reply; 4+ messages in thread
From: Czuczy Gergely @ 2004-02-03 07:25 UTC (permalink / raw)
To: pgsql-performance
Hello
i've read in the docs to use the proper indexes both types must match in
the where clause, to achive this the user can simply put a string into the
side of the equation mark and pgsql will convert it automaticly. my
question is, when I'm using PQexecParams, should I give all the values as
a string, and it will be converted, or I have to figure out the type of
the given field somehow? i'm writing an interface for my php extension(i'm
not statisfied by the boundled), so i cannot figure out the type of the
fields in most cases. what should be done for the best performance in this
situation?
Bye,
Gergely Czuczy
mailto: phoemix@harmless.hu
PGP: http://phoemix.harmless.hu/phoemix.pgp
The point is, that geeks are not necessarily the outcasts
society often believes they are. The fact is that society
isn't cool enough to be included in our activities.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PQexecParams and types
@ 2004-02-03 14:53 Tom Lane <tgl@sss.pgh.pa.us>
parent: Czuczy Gergely <phoemix@harmless.hu>
0 siblings, 1 reply; 4+ messages in thread
From: Tom Lane @ 2004-02-03 14:53 UTC (permalink / raw)
To: Czuczy Gergely <phoemix@harmless.hu>; +Cc: pgsql-performance
Czuczy Gergely <phoemix@harmless.hu> writes:
> i've read in the docs to use the proper indexes both types must match in
> the where clause, to achive this the user can simply put a string into the
> side of the equation mark and pgsql will convert it automaticly. my
> question is, when I'm using PQexecParams, should I give all the values as
> a string, and it will be converted, or I have to figure out the type of
> the given field somehow?
You should leave the parameter types unspecified. Their types will be
resolved in much the same way that a quoted literal is handled.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PQexecParams and types
@ 2004-02-03 14:56 Czuczy Gergely <phoemix@harmless.hu>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 4+ messages in thread
From: Czuczy Gergely @ 2004-02-03 14:56 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-performance
hello
to leave it unspecified what value should I set to the paramTypes array?
and could you insert this answer to to docs, it could be useful
Bye,
Gergely Czuczy
mailto: phoemix@harmless.hu
PGP: http://phoemix.harmless.hu/phoemix.pgp
The point is, that geeks are not necessarily the outcasts
society often believes they are. The fact is that society
isn't cool enough to be included in our activities.
On Tue, 3 Feb 2004, Tom Lane wrote:
> Czuczy Gergely <phoemix@harmless.hu> writes:
> > i've read in the docs to use the proper indexes both types must match in
> > the where clause, to achive this the user can simply put a string into the
> > side of the equation mark and pgsql will convert it automaticly. my
> > question is, when I'm using PQexecParams, should I give all the values as
> > a string, and it will be converted, or I have to figure out the type of
> > the given field somehow?
>
> You should leave the parameter types unspecified. Their types will be
> resolved in much the same way that a quoted literal is handled.
>
> regards, tom lane
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PQexecParams and types
@ 2004-02-03 15:27 Tom Lane <tgl@sss.pgh.pa.us>
parent: Czuczy Gergely <phoemix@harmless.hu>
0 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2004-02-03 15:27 UTC (permalink / raw)
To: Czuczy Gergely <phoemix@harmless.hu>; +Cc: pgsql-performance
Czuczy Gergely <phoemix@harmless.hu> writes:
> to leave it unspecified what value should I set to the paramTypes array?
> and could you insert this answer to to docs, it could be useful
It is in the docs:
paramTypes[] specifies, by OID, the data types to be assigned to the
parameter symbols. 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.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2004-02-03 15:27 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-02-03 07:25 PQexecParams and types Czuczy Gergely <phoemix@harmless.hu>
2004-02-03 14:53 ` Tom Lane <tgl@sss.pgh.pa.us>
2004-02-03 14:56 ` Czuczy Gergely <phoemix@harmless.hu>
2004-02-03 15:27 ` Tom Lane <tgl@sss.pgh.pa.us>
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