[Dbix-class] Re: prepending Pg schema name in queries

Peter Shangov pshangov at yahoo.com
Wed Jul 7 11:04:22 GMT 2010


Please ignore this message, I have fixed the issue.

Regards,



----- Original Message ----
> From: Peter Shangov <pshangov at yahoo.com>
> To: dbix-class at lists.scsys.co.uk
> Sent: Wed, 7 July, 2010 13:22:55
> Subject: prepending Pg schema name in queries
> 
> 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,
> 
> 



More information about the DBIx-Class mailing list