<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 483: Using distribution column in updateable view does not work</title><link>https://sourceforge.net/p/postgres-xc/bugs/483/</link><description>Recent changes to 483: Using distribution column in updateable view does not work</description><atom:link href="https://sourceforge.net/p/postgres-xc/bugs/483/feed.rss" rel="self"/><language>en</language><lastBuildDate>Tue, 04 Mar 2014 00:53:11 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/postgres-xc/bugs/483/feed.rss" rel="self" type="application/rss+xml"/><item><title>#483 Using distribution column in updateable view does not work</title><link>https://sourceforge.net/p/postgres-xc/bugs/483/?limit=25#9412</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Please re-confirm the bug report because I was not able to reproduce it on REL1_2_STABLE.&lt;/p&gt;
&lt;p&gt;Also please share the output of &lt;br /&gt;
explain verbose update v1 set col2 = 20 where col1 = 2;&lt;/p&gt;
&lt;p&gt;test=# create table t1 (col1 int, col2 int);&lt;br /&gt;
CREATE TABLE&lt;br /&gt;
test=# insert into t1 values (1,1);&lt;br /&gt;
INSERT 0 1&lt;br /&gt;
test=# &lt;br /&gt;
test=# create view v1 as select * from t1;&lt;br /&gt;
CREATE VIEW&lt;br /&gt;
test=# insert into v1 values (2,2);&lt;br /&gt;
INSERT 0 1&lt;br /&gt;
test=# update v1 set col2 = 20 where col1 = 2;&lt;br /&gt;
UPDATE 1&lt;br /&gt;
test=# update v1 set col2 = 20 where col2 = 2;&lt;br /&gt;
UPDATE 0&lt;br /&gt;
test=# explain verbose update v1 set col2 = 20 where col1 = 2;&lt;br /&gt;
                                                   QUERY PLAN                                                 &lt;br /&gt;
&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Update on public.t1  (cost=0.00..0.00 rows=1000 width=14)&lt;br /&gt;
   Node/s: data_node_1, data_node_2, data_node_3, data_node_4&lt;br /&gt;
   Node expr: t1.col1&lt;br /&gt;
   Remote query: UPDATE ONLY public.t1 SET col1 = $1, col2 = $2 WHERE ((t1.ctid = $3) AND (t1.xc_node_id = $4))&lt;br /&gt;
   -&amp;gt;  Data Node Scan on t1 "&lt;em&gt;REMOTE_TABLE_QUERY&lt;/em&gt;"  (cost=0.00..0.00 rows=1000 width=14)&lt;br /&gt;
         Output: t1.col1, 20, t1.col1, t1.col1, t1.ctid, t1.xc_node_id&lt;br /&gt;
         Node/s: data_node_3&lt;br /&gt;
         Remote query: SELECT col1, ctid, xc_node_id FROM ONLY public.t1 WHERE (col1 = 2)&lt;br /&gt;
(8 rows)&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Abbas Butt</dc:creator><pubDate>Tue, 04 Mar 2014 00:53:11 -0000</pubDate><guid>https://sourceforge.netaa7467673417608c656bb04f5ab631379fe03e0c</guid></item><item><title>Using distribution column in updateable view does not work</title><link>https://sourceforge.net/p/postgres-xc/bugs/483/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;I cannot update a view in 1.2 if I include the distribution column in the where clause. Using another column works.&lt;/p&gt;
&lt;p&gt;create table t1 (col1 int, col2 int);&lt;br /&gt;
insert into t1 values (1,1);&lt;/p&gt;
&lt;p&gt;test1=# select * from t1;&lt;br /&gt;
co1l | col2 &lt;br /&gt;
------+------&lt;br /&gt;
    1 |    1&lt;br /&gt;
(1 row)&lt;/p&gt;
&lt;p&gt;test1=# create view v1 as select * from t1;&lt;br /&gt;
CREATE VIEW&lt;br /&gt;
test1=# insert into v1 values (2,2);&lt;br /&gt;
INSERT 0 1&lt;/p&gt;
&lt;p&gt;So far, so good:&lt;/p&gt;
&lt;p&gt;test1=# select * from v1;&lt;br /&gt;
co1l | col2 &lt;br /&gt;
------+------&lt;br /&gt;
    1 |    1&lt;br /&gt;
    2 |    2&lt;br /&gt;
(2 rows)&lt;/p&gt;
&lt;p&gt;test1=# select * from t1;&lt;br /&gt;
co1l | col2 &lt;br /&gt;
------+------&lt;br /&gt;
    1 |    1&lt;br /&gt;
    2 |    2&lt;br /&gt;
(2 rows)&lt;/p&gt;
&lt;p&gt;test1=# update v1 set col2 = 20 where col1 = 2;&lt;br /&gt;
ERROR:  column "col1" does not exist&lt;br /&gt;
LINE 1: update v1 set col2 = 20 where col1 = 2;&lt;br /&gt;
                                      ^&lt;/p&gt;
&lt;p&gt;But, I can use col2 in the where clause:&lt;/p&gt;
&lt;p&gt;test1=# update v1 set col2 = 20 where col2 = 2;&lt;br /&gt;
UPDATE 1&lt;/p&gt;
&lt;p&gt;Note also that there is a similar issue with rules. Referring to a distribution column in rules results in an error where it cannot find the distribution column.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">mason_s</dc:creator><pubDate>Mon, 03 Mar 2014 12:58:41 -0000</pubDate><guid>https://sourceforge.net90bc4d92f184899cbe7ac3fd65275ed490fb0348</guid></item></channel></rss>