From: | Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | elog() error, trying CURENT OF with foreign table |
Date: | 2013-04-19 12:01:44 |
Message-ID: | CAGPqQf0L8dtNtb3_ea4jBvV3JrnuQzcqYuSHtFJbTaiCgNo_yA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
While trying out CURRENT OF with foreign table, ending up with error.
postgres=# select version();
version
-----------------------------------------------------------------------------------------------------------------
PostgreSQL 9.3devel on x86_64-unknown-linux-gnu, compiled by gcc (GCC)
4.4.7 20120313 (Red Hat 4.4.7-3), 64-bit
(1 row)
-- Create exptension & database
postgres=# CREATE EXTENSION postgres_fdw;
CREATE EXTENSION
postgres=# create database regression;
CREATE DATABASE
-- Create foreign server
postgres=# CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw
postgres-# OPTIONS (dbname 'regression');
CREATE SERVER
postgres=# CREATE USER MAPPING FOR CURRENT_USER SERVER loopback;
CREATE USER MAPPING
-- Create table into remote server
postgres=# \c regression
You are now connected to database "regression" as user "rushabh".
regression=# create table test ( a int );
CREATE TABLE
regression=# insert into test values ( 1 );
INSERT 0 1
-- Connect to local server and create test function
regression=# \c postgres
-- Create foreign table
postgres=# create foreign table test ( a int ) server loopback;
CREATE FOREIGN TABLE
postgres=# CREATE OR REPLACE FUNCTION taest_func_dblink2()
postgres-# RETURNS numeric
postgres-# AS $$
postgres$# DECLARE c CURSOR FOR SELECT a FROM test FOR UPDATE;
postgres$# v_i numeric;
postgres$# BEGIN
postgres$# OPEN c;
postgres$# FETCH c INTO v_i;
postgres$# UPDATE test SET a=50 WHERE CURRENT OF c;
postgres$# RETURN 0;
postgres$# END; $$ LANGUAGE plpgsql;
CREATE FUNCTION
postgres=# select taest_func_dblink2();
ERROR: CURRENT OF cannot be executed
CONTEXT: SQL statement "UPDATE test SET a=50 WHERE CURRENT OF c"
PL/pgSQL function taest_func_dblink2() line 7 at SQL statement
Here test ending up with following:
elog(ERROR, "CURRENT OF cannot be executed");
should we change this to ereport() or is there some other fix that we
should make?
Regards,
Rushabh Lathia
www.EnterpriseDB.com
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2013-04-19 12:46:02 | Re: Inconsistent DB data in Streaming Replication |
Previous Message | Greg Stark | 2013-04-18 21:20:08 | Re: Enabling Checksums |