środa, 7 grudnia 2011

Solution Postgres sql error, problem

For pdo postgres errors:

'SQLSTATE[42P01]: Undefined table: 7

SQLSTATE[42703]: Undefined column: 7

try to add quotes in sql for table name and column names. 


Example, good code can be (php):
$sql='SELECT "id","name",
    ("f1"=\'aaa\' OR
    "f1"=\'bbb\') AS "myflag"
        FROM "mytable"';