In Greenplum, specifically versions below 6.11, if you have multiple objects with the same name,
gpreload will fail with the following message:
20200720:15:18:59:028814 gpreload:dcwipphpgp007:gpadmin-[CRITICAL]:-gpreload failed.
(Reason='error 'ERROR: more than one row returned by a subquery used as an expression ' in 'SELECT attname FROM pg_attribute
WHERE attrelid = (SELECT pg_class.oid FROM pg_class, pg_namespace
WHERE pg_class.relname = 'vehicle_revenue_f'
AND pg_namespace.nspname = 'sales')'') exiting...
Here is how to reproduce the error:
gpadmin=# create table sales (a int, b int);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause
-- Using column named 'a' as the Greenplum Database data distribution
key for this table. HINT: The 'DISTRIBUTED BY' clause determines
the distribution of data. Make sure column(s) chosen are
the optimal data distribution key to minimize skew.
CREATE TABLE
gpadmin=# create schema test;
CREATE SCHEMA
gpadmin=# create view test.sales as select * from sales;
CREATE VIEW
gpadmin=# \q
[gpadmin@gpdb2-m tmp]$ cat gpreload public.sales: a, b
[gpadmin@gpdb2-m tmp]$ gpreload -d gpadmin -t gpreload
20200730:18:33:19:016880 gpreload:gpdb2-m:gpadmin-[
INFO]:-Starting gpreload with args: -d gpadmin -t gpreload 20200730:18:33:19:016880 gpreload:gpdb2-m:gpadmin-
[INFO]:-Validating table file gpreload 20200730:18:33:19:016880
gpreload:gpdb2-m:gpadmin-[INFO]:-Obtaining parent partitions 20200730:18:33:19:016880 gpreload:gpdb2-m:gpadmin-
[INFO]:-Validating tables 20200730:18:33:19:016880 gpreload:gpdb2-m:gpadmin-[CRITICAL]:-gpreload failed.
(Reason='error 'ERROR: more than one row returned by a subquery used as an expression ' in 'SELECT attname FROM pg_attribute
WHERE attrelid = (SELECT pg_class.oid FROM pg_class, pg_namespace
WHERE pg_class.relname = 'sales' AND pg_namespace.nspname = 'public')'') exiting...