Comments (2)
In the Citus, the range table entries in a query are mocked as RTE_FUNCTION entries.
MultiLogicalPlanCreate
MultiNodeTree takes { List *rangeTableList = queryTree->rtable }
MultiTableNodeList(tableEntryList, rangeTableList);
{ for each table in Join tableNode->referenceNames = rangeTableEntry->eref; }
BaseRangeTableList
{ RTE_FUNCTION rangeTableEntry->eref = multiTable->referenceNames; }
SetRangeTblExtraData { funccolcount = list_length(rte->eref->colnames); }
Here the funccolcount
gets the unaltered table's column count, i.e. 1, from the parse tree
During the runtime
AcquireRewriteLocks
foreach(l, parsetree->rtable)
RTE_JOIN entry for each rte->joinaliasvars
{rte->joinaliasvars gets the latest columns in expandRTE() -- expand the columns of a rangetable entry}
and for each Var it calls
{ if (get_rte_attribute_is_dropped(curinputrte, aliasvar->varattno)) to check if any column is dropped }
This results in the ERROR as the curinputrte
(RTE_FUNCTION) till has old column count in funccolcount.
ERROR: column 2 of relation "r" does not exist
This could be related to this change where we added expandRTE
to accommodate dropped columns.
from citus.
This simple fix appears to have resolved the issue, but it may have other consequences, so we need to take a comprehensive look.
diff --git a/src/backend/distributed/utils/citus_nodefuncs.c b/src/backend/distributed/utils/citus_nodefuncs.c
index 55b83e6c5..110c61d1c 100644
--- a/src/backend/distributed/utils/citus_nodefuncs.c
+++ b/src/backend/distributed/utils/citus_nodefuncs.c
@@ -142,7 +142,16 @@ SetRangeTblExtraData(RangeTblEntry *rte, CitusRTEKind rteKind, char *fragmentSch
fauxFunction->funcexpr = (Node *) fauxFuncExpr;
/* set the column count to pass ruleutils checks, not used elsewhere */
+#if 0
fauxFunction->funccolcount = list_length(rte->eref->colnames);
+#endif
+ if (rte->relid != 0)
+ {
+ Relation rel = RelationIdGetRelation(rte->relid);
+ fauxFunction->funccolcount = RelationGetNumberOfAttributes(rel);
+ RelationClose(rel);
+ }
+
fauxFunction->funccolnames = funcColumnNames;
fauxFunction->funccoltypes = funcColumnTypes;
fauxFunction->funccoltypmods = funcColumnTypeMods;
from citus.
Related Issues (20)
- Debezium cannot auto create table when sink data from kafka HOT 1
- Add template schemas for easier distributed schema management HOT 3
- Azure Cosmos DB for Postgres HOT 2
- Consider propagating GRANTs for the database where Citus is installed too
- Is there a schedule for distributed snapshot isolation? HOT 1
- Flaky tests to fix
- Intra-node isolation anomaly HOT 2
- Harden database commands against failures
- Do nothing for database command if the database is not distributed
- citus-11.1.4/src/include/pg_version_compat.h:59:1: error: redefinition of ‘RelationGetSmgr’ HOT 1
- Build error on linux 20.04. with postgres 14 HOT 1
- Segmentation fault CASE WHEN with DO block
- Table ownership not working for distributed tables HOT 1
- Cannot add workers HOT 2
- Unable to create distributed table with enum column in a transaction
- Properly handle implicit database dependencies for CREATE/ALTER DATABASE commands
- Implicitly propagate roles when `GRANT ..ON <type> <objects> TO <roles>` stmt refers to distributed <type> objects
- Drop View Propagation Error HOT 1
- Rebalance bug with local tables on citus 10.2 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from citus.