查询没有结果数据 postgresql 的目的地
query has no destination for result data postgresql
I am trying to fetch data from different db by using dblink through function but getting an error "query has no destination for result
data"
ERROR: query has no destination for result data
HINT: If
you want to discard the results of a SELECT, use PERFORM instead.
这是我的查询
-- ns_core_customer_group
insert into
ns_core_customer_group(customer_group_id,
customer_group_code,
customer_group_name,
advance_percent,
discount_percent,
sync_id,
is_active,
is_deleted,
created_stamp,
created_user,
last_modified_stamp,
last_modified_user)
select customer_group_id,
concat(local_store_id,'-',customer_group_id),
customer_group_name,
advance_percent,
discount_percent,
3,
is_active,
is_deleted,
created_stamp,
created_user,
last_modified_stamp,
last_modified_user
from dblink('host=localhost user=postgres password=admin dbname=Fulfil_1.9.1','select customer_group_id,
customer_group_code,
customer_group_name,
advance_percent,
discount_percent,
is_active,
is_deleted,
created_stamp,
created_user,
last_modified_stamp,
last_modified_user from ns_core_customer_group')
AS t1(customer_group_id integer,
customer_group_code character varying(50),
customer_group_name character varying(255),
advance_percent numeric(5,2),
discount_percent numeric(5,2),
is_active integer,
is_deleted integer,
created_stamp timestamp without time zone,
created_user integer,
last_modified_stamp timestamp without time zone,
last_modified_user integer);
select setval('ns_core_customer_group_id_seq', (select coalesce(max(customer_group_id),0)+1 from ns_core_customer_group), false);
执行此操作:
setval(
'ns_core_customer_group_id_seq',
(select coalesce(max(customer_group_id),0)+1 from ns_core_customer_group),
false
);
I am trying to fetch data from different db by using dblink through function but getting an error "query has no destination for result data"
ERROR: query has no destination for result data
HINT: If you want to discard the results of a SELECT, use PERFORM instead.
这是我的查询
-- ns_core_customer_group
insert into
ns_core_customer_group(customer_group_id,
customer_group_code,
customer_group_name,
advance_percent,
discount_percent,
sync_id,
is_active,
is_deleted,
created_stamp,
created_user,
last_modified_stamp,
last_modified_user)
select customer_group_id,
concat(local_store_id,'-',customer_group_id),
customer_group_name,
advance_percent,
discount_percent,
3,
is_active,
is_deleted,
created_stamp,
created_user,
last_modified_stamp,
last_modified_user
from dblink('host=localhost user=postgres password=admin dbname=Fulfil_1.9.1','select customer_group_id,
customer_group_code,
customer_group_name,
advance_percent,
discount_percent,
is_active,
is_deleted,
created_stamp,
created_user,
last_modified_stamp,
last_modified_user from ns_core_customer_group')
AS t1(customer_group_id integer,
customer_group_code character varying(50),
customer_group_name character varying(255),
advance_percent numeric(5,2),
discount_percent numeric(5,2),
is_active integer,
is_deleted integer,
created_stamp timestamp without time zone,
created_user integer,
last_modified_stamp timestamp without time zone,
last_modified_user integer);
select setval('ns_core_customer_group_id_seq', (select coalesce(max(customer_group_id),0)+1 from ns_core_customer_group), false);
执行此操作:
setval(
'ns_core_customer_group_id_seq',
(select coalesce(max(customer_group_id),0)+1 from ns_core_customer_group),
false
);