summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMason S2010-05-13 01:09:44 +0000
committerPavan Deolasee2011-05-19 16:38:46 +0000
commit458f2058e628fe721b3d5fd42f7038a1403d97cc (patch)
tree7f72364db74239e99bfd32d4f420bd069303a726 /src/include
parentb95b8c84c1f2b5cf5f9c55c5b4cb3448771660e2 (diff)
This is the first of some planned changes to recognize more "Postgres-XC safe"
queries, before we implement more complex cross-node operations. This focuses on native pg_catalog based views like pg_settings. This is because it used by pgadmin. With the attached patch, pgadmin no longer complains about such queries because they are now supported. The PostgreSQL query rewriter appears to convert the view into a subquery. I modified the XC planner to check for pg_catalog table usage in the FROM clause (and subqueries thereof). In addition, pgadmin was sending "SET client_encoding to 'UNICODE'". It was being swallowed and proxied by Postgres-XC, but no response was sent back because it did not recognize the 'S' message response. I have now added support for that, too. Note that we have planned a whole separate task planned for proper SET handling. These commands will now be processed, but the user should not assume that these will remain set, due to Postgres-XC pooler. Again, we will address this in the future. With this patch pgadmin runs much more smoothly when connected to Postgres-XC. Users can view schema information and issue SQL statements. There is still an error window that pops up when clicking on a table because it issues a "SELECT count(*) FROM table", which is not yet supported in Postgres-XC. This problem will disappear soon however, as a patch is almost ready for basic aggregate support.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/pgxc/locator.h10
-rw-r--r--src/include/utils/lsyscache.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/src/include/pgxc/locator.h b/src/include/pgxc/locator.h
index 335701c282..46a8f9ec58 100644
--- a/src/include/pgxc/locator.h
+++ b/src/include/pgxc/locator.h
@@ -42,6 +42,15 @@ typedef struct
} RelationLocInfo;
+/* track if tables use pg_catalog */
+typedef enum
+{
+ TABLE_USAGE_TYPE_NO_TABLE,
+ TABLE_USAGE_TYPE_PGCATALOG,
+ TABLE_USAGE_TYPE_USER_TABLE,
+ TABLE_USAGE_TYPE_MIXED
+} TableUsageType;
+
/*
* Nodes to execute on
* primarynodelist is for replicated table writes, where to execute first.
@@ -53,6 +62,7 @@ typedef struct
List *primarynodelist;
List *nodelist;
char baselocatortype;
+ TableUsageType tableusagetype; /* track pg_catalog usage */
} Exec_Nodes;
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index 4428b22d59..854b3eac9a 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -76,6 +76,9 @@ extern Oid get_negator(Oid opno);
extern RegProcedure get_oprrest(Oid opno);
extern RegProcedure get_oprjoin(Oid opno);
extern char *get_func_name(Oid funcid);
+#ifdef PGXC
+extern Oid get_func_namespace(Oid funcid);
+#endif
extern Oid get_func_rettype(Oid funcid);
extern int get_func_nargs(Oid funcid);
extern Oid get_func_signature(Oid funcid, Oid **argtypes, int *nargs);