On Thu, Aug 24, 2006 at 11:31:02AM -0700, David Fetter wrote: > Folks, > > I've found a little lacuna in the RETURNING feature, that being in > PL/Perl's spi_prepare()/spi_execute_prepared() as illustrated in the > attached file on CVS TIP. > > I think that fixing this is a matter of post-RETURNING-patch cleanup. > What else might not know about RETURNING that needs to? > > Cheers, > D
Oops. This time, with the actual file attached :P Cheers, D -- David Fetter <[EMAIL PROTECTED]> http://fetter.org/ phone: +1 415 235 3778 AIM: dfetter666 Skype: davidfetter Remember to vote!
DROP TABLE IF EXISTS foo; CREATE TABLE foo ( foo_id SERIAL PRIMARY KEY, foo_text TEXT NOT NULL ); CREATE OR REPLACE FUNCTION foo_insert( in_foo_text TEXT ) RETURNS INTEGER LANGUAGE plperlu AS $$ use strict; elog NOTICE, "in_foo_text is $_[0]"; my $sql = <<'SQL'; INSERT INTO foo ( foo_text ) VALUES ( $1 ) RETURNING foo_id SQL elog NOTICE, $sql; my $sth = spi_prepare($sql, 'TEXT'); my $foo_id = spi_exec_prepared( $sth, $_[0], )->{rows}->[0]->{foo_id}; spi_freeplan($sth); return $foo_id; $$; SELECT foo_insert('blargh'::TEXT);
---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match