new Pg patch (was Re: [Dbix-class] PK::Auto::Pg patch)
David Kamholz
davekam at pobox.com
Sun Dec 11 16:59:24 CET 2005
On Dec 11, 2005, at 3:30 PM, Mike Rylander wrote:
> Just off the top of my head after scanning the patch, it doesn't have
> support for tables in non-default schemas (Postgres namespaces).
> However, I have no idea whether this is a limitation of D::C or just
> ::Auto::Pg.
>
> Just my $.02, and thanks for all the work on D::C!
It is a limitation of the current implementation of DBIx::Class,
although not a fatal one. You can use a table from any schema by
giving a full path when you set the table name with __PACKAGE__->table
(). The auto-inc case is trickier, because column_info() won't
necessarily work right unless you pass the schema name. I've avoided
trying to hack this in to PK::Auto::Pg for now, as the information
should ideally be provided to it by DBIx::Class in the first place.
However, you can still make sure your search path will turn up the
table you have in mind first, and then use its (non-schema-qualified)
name in __PACKAGE__->table(). Ugly, I know.
Anyway, I've rewritten the PK::Auto::Pg patch again, because the
latest one still has an unnecessary column_info call to get a list of
primary keys. It works for me on my Pg install and I'm hoping it will
work for others as well, please test if you have a chance. It also
warns you about the temporary table before doing the test and cleans
up after it's done. Also added whitespace in two lines, so as not to
encourage people to leave it out in assignments. ;-)
Regards, Dave (ningu)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pg.diff
Type: application/octet-stream
Size: 2404 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20051211/f6062b21/pg.obj
More information about the Dbix-class
mailing list