Menu

#4614 Postgres module doesn't display any tables starting with sql

1.740
closed-fixed
nobody
None
5
2015-06-18
2015-06-17
No

The file webmin/postgresql/postgresql-lib.pl lists the tables in the database but applies a filter of ' not like \'pg_%\' and tablename not like \'sql_%\' this is incorrect as the _ character is a special matcher (any single character) as such any table starting with sql will be ignored. The line should be escaped to match the _ literally.
Line 170
local $t = &execute_sql_safe($[0], 'select schemaname,tablename from pg_tables where tablename not like \'pg%\' and tablename not like \'sql_%\' order by tablename');
Should be
local $t = &execute_sql_safe($[0], 'select schemaname,tablename from pg_tables where tablename not like \'pg^%\' and tablename not like \'sql^_%\' ESCAPE \'^\' order by tablename');

And line 174
local $t = &execute_sql_safe($[0], 'select tablename from pg_tables where tablename not like \'pg%\' and tablename not like \'sql_%\' order by tablename');
Should be
local $t = &execute_sql_safe($[0], 'select tablename from pg_tables where tablename not like \'pg^%\' and tablename not like \'sqli^_%\' ESCAPE \'^\' order by tablename');

Discussion

  • Kevin Wilkie

    Kevin Wilkie - 2015-06-17

    sorry, last line should be the following (errant i in \'sql^%\')
    local $t = &execute_sql_safe($[0], 'select tablename from pg_tables where tablename not like \'pg^%\' and tablename not like \'sql^
    %\' ESCAPE \'^\' order by tablename');

     
  • Jamie Cameron

    Jamie Cameron - 2015-06-18
    • status: open --> closed-fixed
     
  • Jamie Cameron

    Jamie Cameron - 2015-06-18

    I'll fix this in the next Webmin release, although using Perl to do the filtering rather than SQL.

     

Log in to post a comment.