Issues

ZF-8046: fix a todo in pgsql.php pdo code public function listTables()

Issue Type: Patch Created: 2009-10-10T18:10:59.000+0000 Last Updated: 2013-02-13T12:06:28.000+0000 Status: Reopened Fix version(s): Reporter: Cedric (klando) Assignee: Mickael Perraud (mikaelkael) Tags: - Zend_Db

Related issues: - ZF-8455

Attachments: - ZF.patch

Description

Just a little imrovment as suggested in the code

Comments

Posted by Mickael Perraud (mikaelkael) on 2009-11-19T10:29:17.000+0000

Patch applied and tested with r19051

Posted by Abdala Cerqueira (abdalac) on 2009-12-03T07:21:16.000+0000

It did not work. I use PostgreSql version 1.8.4

My sugestion:

<pre class="highlight">
$sql = "SELECT c.relname  AS table_name "
              . "FROM pg_catalog.pg_class c "
              . "JOIN pg_catalog.pg_roles r ON r.oid = c.relowner "
              . "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace "
              . "WHERE n.nspname <> 'pg_catalog' "
              . "AND n.nspname !~ '^pg_toast' "
              . "AND c.relname !~ '^(pg_|sql_)' "
              . "AND c.relkind = 'r' ";

Posted by Ramon Henrique Ornelas (ramon) on 2009-12-03T08:20:37.000+0000

Problem in pg_catalog.pg_table_is_visible(c.oid)

resolved through of the

SET search_path TO

Posted by Mickael Perraud (mikaelkael) on 2009-12-03T10:11:09.000+0000

My fault, this commit wasn't suppose to be in branch but only in trunk that's why the "Fix Versions" field was "Next minor release" I will revert it in branch ASAP.

Posted by Cedric (klando) on 2009-12-07T10:22:08.000+0000

I failed to answer and have to re-edit the ticket..

All is to know what do you realy expect when using show tables. Query provided is fine.

Perhaps you just want to select like that :

select table_schema, table_name from information_schema.tables where table_schema <> 'pg_catalog' and table_schema !~ '^pg_toast' and table_schema <> 'information_schema';

or just ommit the is_visible from the First query, but please keep clear of that : "AND c.relname !~ '^(pg_|sql_)' " which is useless and can just lead to errors. (damn! do you really suggest I can not have a table name "sql_zend" or "pg_rox" ?!)

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts