From be4da986ecb2d361ade2aec84c880fa61688f7ef Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Wed, 17 Jun 2015 19:55:13 -0700 Subject: [PATCH] Use perl to filter out unwanted tables, as _ is a special character in SQL likes https://sourceforge.net/p/webadmin/bugs/4614/ --- postgresql/postgresql-lib.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/postgresql/postgresql-lib.pl b/postgresql/postgresql-lib.pl index 93ab00370..8f032225e 100755 --- a/postgresql/postgresql-lib.pl +++ b/postgresql/postgresql-lib.pl @@ -167,12 +167,13 @@ return $t->{'data'}->[0]->[0] ? 1 : 0; sub list_tables { if (&supports_schemas($_[0])) { - 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'); - return map { ($_->[0] eq "public" ? "" : $_->[0].".").$_->[1] } @{$t->{'data'}}; + local $t = &execute_sql_safe($_[0], 'select schemaname,tablename from pg_tables order by tablename'); + return map { ($_->[0] eq "public" ? "" : $_->[0].".").$_->[1] } + grep { $_->[1] !~ /^(pg|sql)_/ } @{$t->{'data'}}; } else { - local $t = &execute_sql_safe($_[0], 'select tablename from pg_tables where tablename not like \'pg_%\' and tablename not like \'sql_%\' order by tablename'); - return map { $_->[0] } @{$t->{'data'}}; + local $t = &execute_sql_safe($_[0], 'select tablename from pg_tables order by tablename'); + return map { $_->[0] } grep { $_->[0] !~ /^(pg|sql)_/ } @{$t->{'data'}}; } }