Forum: Rails-core (closed, excessive spam) PG_Namespace cartesian join in postgresql_adapter.rb

193e9af84ac81f9787e3204d2b749980?d=identicon&s=25 Bob (Guest)
on 2008-04-25 17:11
(Received via mailing list)
I'm working on a patch to Rails 2.0.2 to address a cartesian join with
PG_namespace in activerecord-2.0.2/lib/active_record/
connection_adapters/postgresql_adapter.rb.  (around line 559 or so).

What I'm wondering is this:  did the original author intend to
retrieve the namespace (schema) for the database object (the sequence
that feeds the primary key, in this case), and if so, what was the
reason?  Its probably a good one, and I'd like the patch to do the
necessary in the correct fashion.  The current query doesn't return
the schema name, so I'm thinking maybe it should, but Rails works fine
without it, since the convention (!) is to have the table and sequence
in the same schema namespace, which is in the login's search path in
PostgreSQL.

As an old, crusty DBA/developer, I'd prefer to have a trigger populate
the surrogate primary key, but I understand this is not the One True
Rails Way, so I'm not going to fight it.  (Not here, anyway.  I'll
hack my own code to do what I think it needs to do.)

Any thoughts?  Please share...
Efa76b164a7de4a5730e4fa397cc4425?d=identicon&s=25 Michael Koziarski (Guest)
on 2008-04-26 02:35
(Received via mailing list)
>  I'm working on a patch to Rails 2.0.2 to address a cartesian join with
>  PG_namespace in activerecord-2.0.2/lib/active_record/
>  connection_adapters/postgresql_adapter.rb.  (around line 559 or so).

The only thing I can remember changing in recent history is:

http://github.com/rails/rails/commit/b3b0a0c388b27...

Is this what introduced it?  You can see the rationale in:

http://dev.rubyonrails.org/ticket/8659
--
Cheers

Koz
This topic is locked and can not be replied to.