[Dbix-class] prepending Pg schema name in queries
Ash Berlin
ash_cpan at firemirror.com
Wed Jul 7 10:32:41 GMT 2010
Just doing __PACKAGE__->table("materials.user"); works for us here.
I'm not quite sure how the materials is getting stripped off. Although to be fair we are only on v0.08112
-ash
On 7 Jul 2010, at 11:22, Peter Shangov wrote:
> Hi,
>
> I have the following schema class to access the 'user' table from the
> 'materials' schema in a PostgreSQL database:
>
> package ADP::Schema::Materials::Result::User;
> use base 'DBIx::Class::Core';
> __PACKAGE__->table("materials.user");
> ...
>
> Later on, the following code:
>
> my $schema = ADP::Schema::Materials->connect( ... );
> my $rs = $schema->resultset('User')->all;
>
> produces an error:
>
> DBI Exception: DBD::Pg::st execute failed: ERROR: column notation .user_id
> applied to type name, which is not a composite type
> LINE 1: SELECT me.user_id, me.username, me.name, me.name_local, me.e...
> ^ [for Statement "SELECT me.user_id, me.username, me.name,
> me.name_local, me.email, me.active, me.cms2_id, me.cms3_id, me.wordpress_id FROM
> user me"] at C:/strawberry/perl/site/lib/DBIx/Class/Schema.pm line 1026
>
> This error is due to the fact that 'user' is a reserved word and "SELECT ...
> FROM user" fails. How can I force DBIx::Class to prepend the schema name to the
> table in the query, to get "SELECT ... FROM materials.user"?
>
> Regards,
>
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
More information about the DBIx-Class
mailing list