database
database copied to clipboard
PostgreSQL: select() fails when column name has all big letters
$context->query('DROP SCHEMA IF EXISTS public CASCADE');
$context->query('CREATE SCHEMA public');
$context->query('
CREATE TABLE "public"."bug12" (
"id" serial,
"PSC" varchar(5),
PRIMARY KEY ("id")
)
');
$context->table("bug12")->insert(array(
'PSC' => "61600"
));
$row = $context->table("bug12")->select("PSC")->fetch();
Throws: PDOException: SQLSTATE[42703]: Undefined column: 7 ERROR: column "psc" does not exist
This is already fixed, it should be closed.
IMHO this is not fixed.
You're right, but workaround for this could be sth. like this
$row = $context->table("bug12")->select('"PSC"')->fetch()
Yep, but this is really wrong. The same mistake that has been done in Doctrine. http://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/reference/basic-mapping.html#quoting-reserved-words
You are moving DBAL responsibilities into your application code.