Added support for namespaces(schemas) in PostgreSql platform for Views #369

Merged
merged 3 commits into from Dec 20, 2013

Projects

None yet

4 participants

@ikulis
Contributor
ikulis commented Sep 11, 2013

No description provided.

@doctrinebot

Hello,

thank you for creating this pull request. I have automatically opened an issue
on our Jira Bug Tracker for you. See the issue link:

http://www.doctrine-project.org/jira/browse/DBAL-601

We use Jira to track the state of pull requests and the versions they got
included in.

@deeky666 deeky666 and 1 other commented on an outdated diff Sep 11, 2013
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
@@ -231,7 +231,7 @@ public function getListTablesSQL()
*/
public function getListViewsSQL($database)
{
- return 'SELECT viewname, definition FROM pg_views';
+ return 'SELECT schemaname || \'.\' || viewname as viewname, definition FROM pg_views';
@deeky666
deeky666 Sep 11, 2013 Member

Wouldn't it be better to enclose the string into double quotes to avoid the escaping? That reads better IMO.

@ikulis
ikulis Sep 11, 2013 Contributor

There no php variables inside so Ive left the quotes how they ware. Looking at the rest of the file its hard to guess what is the convention.

@beberlei
Member

This is a BC break

@ikulis
Contributor
ikulis commented Sep 11, 2013

@beberlei you mean the feature won`t be implemented anyhow or that additional changes are needed?
The View behaves now in the same way as Table does.

@beberlei
Member

@ikulis I am not sure how this affects the View instance, though a quick review shows that the default namespace handling works here as well, so it might work out backwards compatible for SchemaManager. However I would still suggest to return the schemaname as new column, and then adjust _getPortableViewDefinition() to do the string concatenation.

@ikulis
Contributor
ikulis commented Sep 11, 2013

@beberlei changed as requested

@ikulis
Contributor
ikulis commented Sep 11, 2013

@beberlei About BC, now is see that in _getPortableSequenceDefinition() the schema is made empty if public. Probably the BC was indented that way.Table checks the first schema in search paths though.

see: https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php#L202
see: https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php#L263

@beberlei beberlei merged commit 99180eb into doctrine:master Dec 20, 2013

1 check passed

default The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment