diff --git a/ckanext/datastore/plugin.py b/ckanext/datastore/plugin.py index e4a30f82445..2abd00f73bc 100644 --- a/ckanext/datastore/plugin.py +++ b/ckanext/datastore/plugin.py @@ -75,7 +75,7 @@ def new_resource_show(context, data_dict): try: connection = engine.connect() result = connection.execute( - 'SELECT 1 FROM pg_tables WHERE tablename = %s', + 'SELECT 1 FROM "_table_metadata" WHERE name = %s AND alias_of IS NULL', new_data_dict['id'] ).fetchone() if result: