[BioRuby] BioSQL - postgres refusing SQL generated by Bio::SQL::establish_connection

Rob Syme rob.syme at gmail.com
Mon Nov 14 06:07:47 UTC 2011


Hi all,
Full details are up at: http://gist.github.com/1363302

This might just be the result of a schema change in BioSQL, but my SQL
knowledge doesn't extend quite far enough. Has anyone come across this
before?

When connecting to an empty postgres BioSQL db, I get an
ActiveRecord::StatementInvalid error:

PGError: ERROR:  cannot perform INSERT RETURNING on relation "ontology"
HINT:  You need an unconditional ON INSERT DO INSTEAD rule with a
RETURNING clause.
: INSERT INTO "ontology" ("definition", "name") VALUES ($1, $2)
RETURNING "ontology_id"
ActiveRecord::StatementInvalid: PGError: ERROR:  cannot perform INSERT
RETURNING on relation "ontology"
HINT:  You need an unconditional ON INSERT DO INSTEAD rule with a
RETURNING clause.
: INSERT INTO "ontology" ("definition", "name") VALUES ($1, $2)
RETURNING "ontology_id"
	from /home/rob/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:1009:in
`prepare'
<snip>
	from /home/rob/.rvm/gems/ruby-1.9.2-p290/gems/bio-1.4.2.5000/lib/bio/io/biosql/biosql.rb:31:in
`establish_connection'


The offending SQL was:

SELECT "ontology".* FROM "ontology" WHERE (name = 'Annotation Tags')
LIMIT 1 # This works fine
INSERT INTO "ontology" ("definition", "name") VALUES ($1, $2)
RETURNING "ontology_id"  [["definition", nil], ["name", "Annotation
Tags"]] # This fails

Relevant gems installed:
  activerecord (3.1.1)
  composite_primary_keys (4.1.1)
  pg (0.11.0)
  bio (1.4.2.5000)

Using:
  psql (PostgreSQL) 9.1.1
  BioSQL schema version 1.0.1 and
  ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

-r



More information about the BioRuby mailing list