Commit 83fe296d authored by Jacek Wysocki's avatar Jacek Wysocki Committed by Benjamin Eberlei

Quote identifiers which can be CamelCased

parent 48a8f7af
...@@ -230,7 +230,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -230,7 +230,7 @@ class PostgreSqlPlatform extends AbstractPlatform
*/ */
public function getListTablesSQL() public function getListTablesSQL()
{ {
return "SELECT tablename AS table_name, schemaname AS schema_name return "SELECT quote_ident(tablename) AS table_name, schemaname AS schema_name
FROM pg_tables WHERE schemaname NOT LIKE 'pg_%' AND schemaname != 'information_schema' AND tablename != 'geometry_columns' AND tablename != 'spatial_ref_sys'"; FROM pg_tables WHERE schemaname NOT LIKE 'pg_%' AND schemaname != 'information_schema' AND tablename != 'geometry_columns' AND tablename != 'spatial_ref_sys'";
} }
...@@ -239,7 +239,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -239,7 +239,7 @@ class PostgreSqlPlatform extends AbstractPlatform
*/ */
public function getListViewsSQL($database) public function getListViewsSQL($database)
{ {
return 'SELECT viewname, schemaname, definition FROM pg_views'; return 'SELECT quote_ident(viewname) as viewname, schemaname, definition FROM pg_views';
} }
/** /**
...@@ -247,7 +247,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -247,7 +247,7 @@ class PostgreSqlPlatform extends AbstractPlatform
*/ */
public function getListTableForeignKeysSQL($table, $database = null) public function getListTableForeignKeysSQL($table, $database = null)
{ {
return "SELECT r.conname, pg_catalog.pg_get_constraintdef(r.oid, true) as condef return "SELECT quote_ident(r.conname) as conname, pg_catalog.pg_get_constraintdef(r.oid, true) as condef
FROM pg_catalog.pg_constraint r FROM pg_catalog.pg_constraint r
WHERE r.conrelid = WHERE r.conrelid =
( (
...@@ -280,7 +280,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -280,7 +280,7 @@ class PostgreSqlPlatform extends AbstractPlatform
public function getListTableConstraintsSQL($table) public function getListTableConstraintsSQL($table)
{ {
return "SELECT return "SELECT
relname quote_ident(relname) as relname
FROM FROM
pg_class pg_class
WHERE oid IN ( WHERE oid IN (
...@@ -300,7 +300,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -300,7 +300,7 @@ class PostgreSqlPlatform extends AbstractPlatform
*/ */
public function getListTableIndexesSQL($table, $currentDatabase = null) public function getListTableIndexesSQL($table, $currentDatabase = null)
{ {
return "SELECT relname, pg_index.indisunique, pg_index.indisprimary, return "SELECT quote_ident(relname) as relname, pg_index.indisunique, pg_index.indisprimary,
pg_index.indkey, pg_index.indrelid pg_index.indkey, pg_index.indrelid
FROM pg_class, pg_index FROM pg_class, pg_index
WHERE oid IN ( WHERE oid IN (
...@@ -338,7 +338,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -338,7 +338,7 @@ class PostgreSqlPlatform extends AbstractPlatform
{ {
return "SELECT return "SELECT
a.attnum, a.attnum,
a.attname AS field, quote_ident(a.attname) AS field,
t.typname AS type, t.typname AS type,
format_type(a.atttypid, a.atttypmod) AS complete_type, format_type(a.atttypid, a.atttypmod) AS complete_type,
(SELECT t1.typname FROM pg_catalog.pg_type t1 WHERE t1.oid = t.typbasetype) AS domain_type, (SELECT t1.typname FROM pg_catalog.pg_type t1 WHERE t1.oid = t.typbasetype) AS domain_type,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment