doAuthPlugin icon indicating copy to clipboard operation
doAuthPlugin copied to clipboard

can not create table user in postgresql

Open sergiovier opened this issue 14 years ago • 7 comments

In PostgreSQL database, the word "user" is a reserved one. See http://www.postgresql.org/docs/8.4/interactive/sql-keywords-appendix.html.

It's possible rename to something like doauth_user, so all tables can have a suffix?

sergiovier avatar May 31 '10 19:05 sergiovier

Yep, sure. Need to think on that

DavertMik avatar May 31 '10 19:05 DavertMik

Yeah, just what I thought :)

DavertMik avatar May 31 '10 19:05 DavertMik

With tableName i can change the related name of the table.

sergiovier avatar May 31 '10 19:05 sergiovier

You can turn on identifier quoting using the Doctrine_Core::ATTR_QUOTE_IDENTIFIER attribute so that the reserved word is escaped with quotes.

In Symfony you can try add one line to config/databases.yml:

all:
  doctrine:
    class: sfDoctrineDatabase
    param:
      dsn:      your dsn string here
      username: username
      password: password
      attributes:
        quote_identifier: true

miamibc avatar Jun 03 '10 08:06 miamibc

Oh, thanks. I really thought Doctrine should do that bu default :) But if it doesn't that's really the best fix for it.

DavertMik avatar Jun 03 '10 08:06 DavertMik

http://trac.doctrine-project.org/ticket/1209

Bugs like this, is another side of this solution. Dunno, i've never used quote_identifier: true, prefer to rename tables ;) Good luck!

miamibc avatar Jun 03 '10 08:06 miamibc

Ok, I will update a prefix in next version.

DavertMik avatar Jun 03 '10 17:06 DavertMik