View Issue Details

IDProjectCategoryView StatusLast Update
0000030Pgpool-IIBugpublic2012-10-26 18:28
ReporterjgentschAssigned Tot-ishii 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000030: pgpool 3.2.1 - views in schema other than public are caching
DescriptionIf a view is in a schema other than public, pgpool doesn't recognize it as a view. It runs this query without the schema prefix:
SELECT count(*) FROM pg_catalog.pg_class AS c WHERE c.oid = pgpool_regclass('some_view') AND c.relkind = 'v'
Steps To ReproduceCreate a new schema.
Create a view in that schema.
Turn on memory_cache_enabled.
Enable log_per_node_statement.
Select from the view.
Select from the view again and you'll see "query result fetched from cache." in the log for that query.
Additional InformationI fixed this in my copy by modifying pool_select_walker.c.
I implemented make_table_name_from_rangevar in view_walker in the exact same way it's implemented in unlogged_table_walker. This fixed my issue, and the logs verified this.

I also tested to make sure views in public still worked, and they do.
TagsNo tags attached.

Activities

t-ishii

2012-10-20 09:06

developer   ~0000113

Thank you for the report. Can we share the patch you made?

jgentsch

2012-10-23 04:26

reporter  

pgpool_3.2.1_pool_select_walker.patch (702 bytes)
--- a/pool_select_walker.c	2012-10-12 01:13:30.000000000 -0400
+++ b/pool_select_walker.c	2012-10-19 09:38:46.000000000 -0400
@@ -368,6 +368,7 @@ static bool
 view_walker(Node *node, void *context)
 {
 	SelectContext	*ctx = (SelectContext *) context;
+	char *relname;
 
 	if (node == NULL)
 		return false;
@@ -375,10 +376,10 @@ view_walker(Node *node, void *context)
 	if (IsA(node, RangeVar))
 	{
 		RangeVar *rgv = (RangeVar *)node;
+		relname = make_table_name_from_rangevar(rgv);
+		pool_debug("view_walker: relname: %s", relname);
 
-		pool_debug("view_walker: relname: %s", rgv->relname);
-
-		if (is_view(rgv->relname))
+		if (is_view(relname))
 		{
 			ctx->has_view = true;
 			return false;

jgentsch

2012-10-26 00:40

reporter   ~0000124

I attached the patch to this ticket.

t-ishii

2012-10-26 18:27

developer   ~0000125

Thanks! Fix committed to master and 3.2-stable branches.

Issue History

Date Modified Username Field Change
2012-10-19 23:13 jgentsch New Issue
2012-10-20 09:06 t-ishii Note Added: 0000113
2012-10-20 09:06 t-ishii Assigned To => t-ishii
2012-10-20 09:06 t-ishii Status new => assigned
2012-10-23 04:26 jgentsch File Added: pgpool_3.2.1_pool_select_walker.patch
2012-10-26 00:40 jgentsch Note Added: 0000124
2012-10-26 18:27 t-ishii Note Added: 0000125
2012-10-26 18:28 t-ishii Status assigned => resolved
2012-10-26 18:28 t-ishii Resolution open => fixed