Skip Menu |

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 50439
Status: rejected
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: hugo.cornejo [...] qindel.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Insertion with reserved word
Date: Tue, 13 Oct 2009 15:03:52 +0200
To: bug-DBIx-Class [...] rt.cpan.org
From: "Hugo Cornejo (QindelGroup)" <hugo.cornejo [...] qindel.com>
Hi, I'm having a little issue running DBIx with PostgreSQL. I have a table named "user" that crashes when I try to make an insertion with resultset('User')->create while any other table works fine. The error, DBIx::Class::ResultSet::create(): DBI Exception: DBD::Pg::st execute failed: ERROR: syntax error at or near "user" LINE 1: INSERT INTO user ( login) VALUES ( $1 ) I think user is a reserved word so DBIx must make the insert with question marks like INSERT INTO "user" ( "login") VALUES ( $1 ) My system, DBIx-Class-0.08112 Perl version: v5.10.0 built for x86_64-linux-gnu-thread-multi OS version: 2.6.31-10-server #34-Ubuntu x86_64 GNU/Linux Cheers, Hugo -- HUGO CORNEJO hugo.cornejo@qindel.com Calle Caleruega, 102-104 3º Der 28033 Madrid - Spain Telf: +34 91 766 24 21 - Fax: +34 91 766 23 57 QindelGroup
On Tue Oct 13 09:04:15 2009, hugo.cornejo@qindel.com wrote: Show quoted text
> Hi, > > I'm having a little issue running DBIx with PostgreSQL. I have a table > named "user" that crashes when I try to make an insertion with > resultset('User')->create while any other table works fine. > > The error, > > DBIx::Class::ResultSet::create(): DBI Exception: DBD::Pg::st execute > failed: ERROR: syntax error at or near "user" > LINE 1: INSERT INTO user ( login) VALUES ( $1 ) > > I think user is a reserved word so DBIx must make the insert with > question marks like INSERT INTO "user" ( "login") VALUES ( $1 )
You probably mean quotes. You need to turn these explicitly. Look for 'quote_char' and 'name_sep' here: http://search.cpan.org/~ribasushi/DBIx-Class-0.08112/lib/DBIx/Class/Storage/DBI.pm#DBIx::Class_specific_connection_attributes
RTFM non-issue.
Subject: Re: [rt.cpan.org #50439] Insertion with reserved word
Date: Wed, 14 Oct 2009 11:19:52 +0200
To: bug-DBIx-Class [...] rt.cpan.org
From: "Hugo Cornejo (QindelGroup)" <hugo.cornejo [...] qindel.com>
Thanks!! HUGO CORNEJO hugo.cornejo@qindel.com Calle Caleruega, 102-104 3º Der 28033 Madrid - Spain Telf: +34 91 766 24 21 - Fax: +34 91 766 23 57 QindelGroup HUGO CORNEJO hugo.cornejo@qindel.com Calle Caleruega, 102-104 3º Der 28033 Madrid - Spain Telf: +34 91 766 24 21 - Fax: +34 91 766 23 57 QindelGroup Peter Rabbitson via RT escribió: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=50439 > > > On Tue Oct 13 09:04:15 2009, hugo.cornejo@qindel.com wrote:
>> Hi, >> >> I'm having a little issue running DBIx with PostgreSQL. I have a table >> named "user" that crashes when I try to make an insertion with >> resultset('User')->create while any other table works fine. >> >> The error, >> >> DBIx::Class::ResultSet::create(): DBI Exception: DBD::Pg::st execute >> failed: ERROR: syntax error at or near "user" >> LINE 1: INSERT INTO user ( login) VALUES ( $1 ) >> >> I think user is a reserved word so DBIx must make the insert with >> question marks like INSERT INTO "user" ( "login") VALUES ( $1 )
> > You probably mean quotes. You need to turn these explicitly. Look for > 'quote_char' and 'name_sep' here: > http://search.cpan.org/~ribasushi/DBIx-Class-0.08112/lib/DBIx/Class/Storage/DBI.pm#DBIx::Class_specific_connection_attributes