Re: postgres adapater problem with create_table :id => false

JeffV
Wed, 21 Oct 2009 00:58:55 -0000

doc_id is not a PK. An accurate model of the table would be:
set_primary_key nil
But the PG postgres adapter is unhappy with that because it''s
generating something like:
  INSERT into the_table VALUES (val1, val2...) RETURNING pk
when pk is nil the postgres adapter is unhappy.
For some reason the composite_primary_keys plugin fixes the problem
(as only a single PK is specified).
To me the problem is the PG adapter. I don''t know why it uses
RETURNING in its INSERT statement.

Jeff

On Oct 20, 9:14 am, Marnen Laibow-Koser <rails-mailing-l...@andreas-
s.net> wrote:
> JeffV wrote:
> > Solved (at least for now):
> > I used the composite primary keys plugin but listed only a single (and
> > fake) primary key:
> >   set_primary_keys :doc_id  # note plural!
>
> > :doc_id is not a PK, and for this logging table it''s possible
there is
> > no combination of columns that will yield a single row, depending on
> > the timing of multi- inserts. But the insert now works and I can move
> > on!
>
> Great!  Now declare doc_id as the PK in the DB.
>
> > Jeff
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org
> --
> Posted viahttp://www.ruby-forum.com/.