I have been forced into using PostgreSQL. I have read something about it but still it's new and I have no idea why I'm getting this error:
SQLSTATE[42703]: Undefined column: 7 ERROR: column t0.id does not exist LINE 1: SELECT t0.id AS id1, t0.user AS user2, t0.email AS ma...
I checked that id column exists for thousand times (almost literally).
I asked my friend and he told me that there is no auto increment in PostgreSQL and I have to use sequences. I found that Doctrine generates sequences automatically when I set @GeneratedValue
to auto (which is default). And yes, those sequences are there.
Here is my entity:
<?php
/**
* @ORM\Entity
*/
class User
{
/**
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/** @ORM\Column(type="string", nullable=true) */
protected $name;
// some more properties similar to $name
In other question (PostgreSQL column 'foo' does not exist) they wanted to see output of \d table
. Here is it:
northys=# \d user
Table "public.user"
Column | Type | Modifiers
----------+------------------------+---------------------------------
id | integer | not null
name | character varying(255) | default NULL::character varying
email | character varying(255) | not null
password | character varying(255) | not null
Indexes:
"user_pkey" PRIMARY KEY, btree (id)
"uniq_8d93d649e7927c74" UNIQUE, btree (email)
Referenced by:
TABLE "child" CONSTRAINT "fk_22b3542941807e1d" FOREIGN KEY (teacher_id) REFERENCES "user"(id)
TABLE "event" CONSTRAINT "fk_3bae0aa7a76ed395" FOREIGN KEY (user_id) REFERENCES "user"(id)
I'm having PostgreSQL 9.4.1 and I`m not using any database specific plugins for doctrine. Do you have any ideas why this shouldn't work? I got stuck and trying to find out the solution for days.