Thread: new RETURNING clause and Pg.pm
I just upgraded to 8.3.3 and taking advantage of the RETURNING clause which is really cool. I've found that with Pg.pm $r->resultStatus returns the integer "2" when the RETURNING clause is used on an insert. Of course, without using RETURNING the status is the constant PGRES_COMMAND_OK. Is checking for "2" my best option? -- Brandon
"Brandon Metcalf" <bmetcalf@nortel.com> writes: > I just upgraded to 8.3.3 and taking advantage of the RETURNING clause > which is really cool. I've found that with Pg.pm $r->resultStatus > returns the integer "2" when the RETURNING clause is used on an > insert. > Of course, without using RETURNING the status is the constant > PGRES_COMMAND_OK. Sounds to me like a bug in Pg.pm --- it's probably not expecting a result to come back from an INSERT. You oughta nag its author about that. regards, tom lane
t == tgl@sss.pgh.pa.us writes: t> "Brandon Metcalf" <bmetcalf@nortel.com> writes: t> > I just upgraded to 8.3.3 and taking advantage of the RETURNING clause t> > which is really cool. I've found that with Pg.pm $r->resultStatus t> > returns the integer "2" when the RETURNING clause is used on an t> > insert. t> > Of course, without using RETURNING the status is the constant t> > PGRES_COMMAND_OK. t> Sounds to me like a bug in Pg.pm --- it's probably not expecting t> a result to come back from an INSERT. You oughta nag its author t> about that. I'll look through the Pg.pm code and see what I can find. -- Brandon
b == bmetcalf@cash.us.nortel.com writes: b> t == tgl@sss.pgh.pa.us writes: b> t> "Brandon Metcalf" <bmetcalf@nortel.com> writes: b> t> > I just upgraded to 8.3.3 and taking advantage of the RETURNING clause b> t> > which is really cool. I've found that with Pg.pm $r->resultStatus b> t> > returns the integer "2" when the RETURNING clause is used on an b> t> > insert. b> t> > Of course, without using RETURNING the status is the constant b> t> > PGRES_COMMAND_OK. b> t> Sounds to me like a bug in Pg.pm --- it's probably not expecting b> t> a result to come back from an INSERT. You oughta nag its author b> t> about that. b> I'll look through the Pg.pm code and see what I can find. My mistake. The constant that gets returned is PGRES_TUPLES_OK which is what I would expect. This corresponds to 2. -- Brandon