#784 hold

PostgreSQL, Insert into without RETURNING

Reported by Ra | January 23rd, 2009 @ 06:12 AM

With versions < 8.2 of PostgreSQL

Fri, 23 Jan 2009 12:05:53 GMT ~ error ~ (sql_state=42601) ERROR: syntax error at or near "RETURNING" at character 262 Query: INSERT INTO "bioentry" ("name", "description", "identifier", "biodatabase_id", "accession", "version", "division") VALUES ('AF264025', 'Streptomyces galilaeus aclacinomycin biosynthetic gene cluster, partial sequence.', 'GI:8133004', 102, 'AF264025', 1, 'BCT') RETURNING "bioentry_id"

the adapter can't handle INSERT INTO without the RETURNING clausle. dm-core-0.9.10/lib/dm-core/adapters/postgres_adapter.rb

    def supports_returning?
      statement = <<-EOS.compress_lines
        SHOW server_version

     query(statement).first >= "8.2.0"


but then there are 2 problems: 1) http://www.postgresql.org/docs/8... standard_conforming_strings — does this release treat backslashes literally in ordinary strings? 2) then dm code I think should get the currval of the sequence implied with the updated table as result of create.

Comments and changes to this ticket

  • Tony Pitale

    Tony Pitale February 1st, 2009 @ 02:52 AM

    • Tag set to bug, do_postgres, postgresql

    I'd like to add that any table with triggers on it will also blow up with version 8.3 of postgresql if you try and use returning. Not sure if that should be a separate ticket or not.

  • Tony Pitale

    Tony Pitale February 1st, 2009 @ 01:49 PM

    Excuse me, not triggers. What I meant was that RULES on insert (in my case) that DO INSTEAD insert somewhere else do not accept RETURNING unless you calculate the row that should be returned. Just a note, not really anything can be done about this except to turn off returning altogether which isn't a good idea.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) February 1st, 2009 @ 02:56 PM

    • State changed from “unconfirmed” to “confirmed”
  • Rob
  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) July 22nd, 2009 @ 03:42 PM

    FYI: Supporting versions of databases that are older than the current stable isn't as high priority as other tickets, however patches against the "next" branch would be accepted to provide this capability.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) February 2nd, 2010 @ 04:09 AM

    • State changed from “confirmed” to “hold”

    If anyone is interested in submitting a ticket for this, I would apply the patch. I'm not familiar enough with older versions of PostgreSQL to know what is needed.

    Marking this on hold for now. If there's no reply/interest shown in this ticket within the next 2-4 weeks I'll close this ticket.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket