[Nitro] [PATCH] og-psql-refactoring

Bryan Soto bryan.a.soto at gmail.com
Sun Apr 9 12:54:43 EDT 2006

On 4/9/06, Kashia Buch <kashia at vfemail.net> wrote:
> Hi,
> > I'd really appreciate if someone could give this a try. I'd rather
> > throw away the last patch if it isn't backward compatible.
> I still can't run test-suits, but I ran Oxyliquit on it.
> Works like before, so, I think that covers some of the tests :D

Well, maybe my response to trans will help with the test suite, but
I'm glad oxy ran. Insertions, deletions, etc. were all okay?

> > Postgres doesn't appear to support autoincrement, so added a new
> > method to SqlStore, generate_key. Postgres uses this to generate the
> > oid value to be inserted. SqlStore defines this method as returning
> > NULL which allows the other stores to autoincrement. This can possibly
> > be extended to allow custom key generation for all the stores.
> so, SERIAL is the keyword here, and NULL gets inserted to get the next oid.
> Does that clarify things?

Very much so. My thanks to you and Reid. :)

I was going by the code in the Psql adapter, which did this:

        res = store.conn.exec "SELECT nextval('#{klass::OGSEQ}')"
        @#{klass.pk_symbol} = res.getvalue(0, 0).to_i

>From that explicit nextval and setting of the key, usually @oid, I
just assumed that it didn't support it. I'll see if I can modify
create_table to use serial then. Though I might leave that
generate_key method in. I can see that it could be useful for people
that need to do something special.

"Never tell people how to do things. Tell them what to do and they
will surprise you with their ingenuity." —General George S. Patton

More information about the Nitro-general mailing list