From: | "Daniel Verite" <daniel(at)manitou-mail(dot)org> |
---|---|
To: | "Scott Frankel" <frankel(at)circlesfx(dot)com> |
Cc: | "PostgreSQL List" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: prepared statements |
Date: | 2010-07-23 21:53:13 |
Message-ID: | 25ac0333-7cf9-4410-9c43-fba7815bb918@mm |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Scott Frankel wrote:
> I've found that, for a table with a
> serial sequence key as its first column, I have to specify the key in
> my prepared statement or I get type errors: ERROR: column "foo_id"
> is of type integer but expression is of type character varying.
Let's try:
test=> create table t(a serial, b int);
NOTICE: CREATE TABLE will create implicit sequence "t_a_seq" for serial
column "t.a"
CREATE TABLE
test=> prepare a as insert into t(b) values($1);
PREPARE
test=> execute a(2);
INSERT 0 1
test=> select * from t;
a | b
---+---
1 | 2
(1 row)
No error here...
Best regards,
--
Daniel
PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2010-07-23 22:01:11 | Re: Finding last checkpoint time |
Previous Message | Marcelo de Moraes Serpa | 2010-07-23 21:22:07 | Prefix LIKE search and indexes issue. |