Christopher Browne cbbrowne at ca.afilias.info
Wed Aug 5 12:45:06 PDT 2009
Devrim GÜNDÜZ <devrim at gunduz.org> writes:
> Hi,
>
> Do we want to support replication with implicit casts re-added? If not,
> please give up reading the rest of this e-mail.
> *****
>
> ======begin here=============== 
> :  operator is not unique: integer || unknown
> LINE 1: SELECT  "_replication".slonyVersionMajor() || '.' || "_repli...
>                                                    ^
> HINT:  Could not choose a best candidate operator. You might need to add explicit type casts.
> QUERY:  SELECT  "_replication".slonyVersionMajor() || '.' || "_replication".slonyVersionMinor() || '.' || "_replication".slonyVersionPatchlevel()
> CONTEXT:  PL/pgSQL function "slonyversion" line 2 at RETURN
> ======================== 

It seems to me that explicitly casting the values is apropos.

Thus...

Index: slony1_funcs.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.145.2.15
diff -c -u -r1.145.2.15 slony1_funcs.sql
cvs diff: conflicting specifications of output style
--- slony1_funcs.sql    31 Jul 2009 19:20:26 -0000      1.145.2.15
+++ slony1_funcs.sql    5 Aug 2009 19:29:09 -0000
@@ -447,9 +447,9 @@
 returns text
 as $$
 begin
-       return @NAMESPACE at .slonyVersionMajor() || '.' ||
-              @NAMESPACE at .slonyVersionMinor() || '.' ||
-              @NAMESPACE at .slonyVersionPatchlevel();
+       return @NAMESPACE at .slonyVersionMajor()::text || '.' ||
+              @NAMESPACE at .slonyVersionMinor()::text || '.' ||
+              @NAMESPACE at .slonyVersionPatchlevel()::text;
 end;
 $$ language plpgsql;
 comment on function @NAMESPACE at .slonyVersion() is


> altertableaddtriggers() fails actually. Here is the related part of this function:
>
> ======begin here=============== 
> -- Create the log and the deny access triggers
> 	-- ----
> 	execute 'create trigger "_replication_logtrigger"' || 
> 			' after insert or update or delete on ' ||
> 			v_tab_fqname || ' for each row execute procedure "_replication".logTrigger (' ||
>                                pg_catalog.quote_literal('_replication') || ',' || 
> ------***fails***--------->	pg_catalog.quote_literal(p_tab_id) || ',' || 
> 				pg_catalog.quote_literal(v_tab_attkind) || ');';
> =======end here============== 
>
> Adding this function surpresses the issue:
>
> ======begin here=============== 
> CREATE OR REPLACE FUNCTION pg_catalog.quote_literal(integer)
>  RETURNS text
>  LANGUAGE sql
>  STRICT COST 1
> AS $function$select
> pg_catalog.quote_literal($1::pg_catalog.text)$function$;
> =======end here============== 

Again, I'd prefer to cast this explicitly, so we're not requiring
external things to rectify "our problem."

@@ -3811,7 +3811,7 @@
                        ' after insert or update or delete on ' ||
                        v_tab_fqname || ' for each row execute procedure @NAMESPACE at .logTrigger (' ||
                                pg_catalog.quote_literal('_ at CLUSTERNAME@') || ',' ||
-                               pg_catalog.quote_literal(p_tab_id) || ',' ||
+                               pg_catalog.quote_literal(p_tab_id::text) || ',' ||
                                pg_catalog.quote_literal(v_tab_attkind) || ');';

        execute 'create trigger "_ at CLUSTERNAME@_denyaccess" ' ||


> ======begin here=============== 
>
> DEBUG2 remoteWorkerThread_2: forward confirm 1,5000001227 received by 2
> NOTICE:  Slony-I: log switch to sl_log_2 complete - truncate sl_log_1
> CONTEXT:  PL/pgSQL function "cleanupevent" line 99 at assignment
> INFO   cleanupThread:    0.010 seconds for cleanupEvent()
> DEBUG1 cleanupThread: minxid: 3258
> ERROR  cleanupThread: "select nspname, relname from "_replication".TablesToVacuum();" - ERROR:  function _replication.shouldslonyvacuumtable(name, name) does not exist
> LINE 1: SELECT  "_replication".ShouldSlonyVacuumTable( $1 ,  $2 )
>                 ^
> HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
> QUERY:  SELECT  "_replication".ShouldSlonyVacuumTable( $1 ,  $2 )
> CONTEXT:  PL/pgSQL function "tablestovacuum" line 6 at IF
> DEBUG1 cleanupThread: number of tables to clean: 0
>
> =======end here============== 

Actually, it looks as though there's a different problem here.  It
looks to me like there's no ShouldSlonyVacuumTable() for 8.3, which is
a different bad thing!

> More is here:
>
> ======begin here=============== 
> CONFIG remoteWorkerThread_1: copy table "public"."film_actor"
> ERROR  remoteWorkerThread_1: "select "_replication".setAddTable_int(1, 1, '"public"."film_actor"', 'film_actor_pkey', 'Table public.film_actor with primary key'); " PGRES_FATAL_ERROR ERROR:  function pg_catalog.quote_literal(integer) is not unique
> LINE 1: ...g_catalog.quote_literal('_replication') || ',' ||
> pg_catalog...
>                                                              ^
> HINT:  Could not choose a best candidate function. You might need to add explicit type casts.
> QUERY:  SELECT  'create trigger "_replication_logtrigger"' || ' after insert or update or delete on ' ||  $1  || ' for each row execute
> procedure "_replication".logTrigger (' || pg_catalog.quote_literal('_replication') || ',' || pg_catalog.quote_literal( $2 ) || ',' || pg_catalog.quote_literal( $3 ) || ');'
> CONTEXT:  PL/pgSQL function "altertableaddtriggers" line 53 at EXECUTE 
> statement SQL statement "SELECT  "_replication".alterTableAddTriggers( $1 )"
> PL/pgSQL function "setaddtable_int" line 109 at PERFORM
> WARN   remoteWorkerThread_1: data copy for set 1 failed - sleep 60
> seconds
> =======end here============== 

That seems to be the same one up above...

> So, is there a known workaround? I hear that many people do add these
> casts while moving to 8.3+, since their application does not work
> without these. Shall we ignore these people?

I think we should allow them to be ignored :-).

I'd be mighty inclined to explicitly cast the integers to text so that
they don't need to add extra configuration for Slony-I to work.
-- 
"cbbrowne","@","ca.afilias.info"
<http://dba2.int.libertyrms.com/>
Christopher Browne
(416) 673-4124 (land)
"Bother,"  said Pooh,  "Eeyore, ready  two photon  torpedoes  and lock
phasers on the Heffalump, Piglet, meet me in transporter room three"


More information about the Slony1-hackers mailing list