I'm trying to use sequel prepared statements feature, enviroment:
sequel 3.5, postgresql 8.4, gem pg 0.8, ruby 1.8.7.
Here minimal code which produces bug:
# c - connection
>> c.create_table :t do Float :x end
=> []
>> ds = c[:t]
=> #<Sequel::Postgres::Dataset: "SELECT * FROM \"t\"">
>> ds.prepare(:insert, :tst_insert, :x => :"$x__double precision")
=> <Sequel::Postgres::Dataset/PreparedStatement "INSERT INTO \"t\" (\"x
\") VALUES ($1::double precision) RETURNING NULL">
>> dsp.call(:x => 1.1)
=> nil
>> dsp.call(:x => nil)
PGError: ERROR: invalid input syntax for type double precision: ""
from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.5.0/lib/sequel/
adapters/postgres.rb:286:in `exec_prepared'
from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.5.0/lib/sequel/
adapters/postgres.rb:286:in `execute_prepared_statement'
from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.5.0/lib/sequel/
connection_pool.rb:112:in `hold'
from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.5.0/lib/sequel/
database.rb:482:in `synchronize'
from /opt/local/lib/ruby/gems/1.8/gems/sequel-3.5.0/lib/sequel/
adapters/postgres.rb:274:in `execute_prepared_statement'
And here corresponding log:
I, [2009-10-21T00:50:32.801014 #36630] INFO -- : CREATE TABLE
"t" ("x" double precision)
I, [2009-10-21T00:50:32.808990 #36630] INFO -- : SET
standard_conforming_strings = ON
I, [2009-10-21T00:50:32.809622 #36630] INFO -- : SET
client_min_messages = 'WARNING'
I, [2009-10-21T00:50:32.809846 #36630] INFO -- : SET DateStyle =
'ISO'
I, [2009-10-21T00:50:58.369613 #36630] INFO -- : SELECT
pg_attribute.attname
FROM pg_class, pg_attribute, pg_index, pg_namespace
WHERE pg_class.oid = pg_attribute.attrelid
AND pg_class.relnamespace = pg_namespace.oid
AND pg_class.oid = pg_index.indrelid
AND pg_index.indkey[0] = pg_attribute.attnum
AND pg_index.indisprimary = 't'
AND pg_class.relname = 't'
I, [2009-10-21T00:51:13.207626 #36630] INFO -- : PREPARE tst_insert
AS INSERT INTO "t" ("
x") VALUES ($1::double precision) RETURNING NULL
I, [2009-10-21T00:51:13.208565 #36630] INFO -- : EXECUTE tst_insert;
["1.1"]
I, [2009-10-21T00:51:16.695338 #36630] INFO -- : EXECUTE tst_insert;
[""]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---