Bug 282 - replication failure where column domain/type is in a schema outside of search_path
Summary: replication failure where column domain/type is in a schema outside of search...
Status: RESOLVED FIXED
Alias: None
Product: Slony-I
Classification: Unclassified
Component: slon (show other bugs)
Version: devel
Hardware: PC Linux
: low major
Assignee: Jan Wieck
URL: https://github.com/wieck/slony1-engin...
Depends on:
Blocks:
 
Reported: 2012-11-20 20:10 UTC by AP
Modified: 2013-01-24 12:24 UTC (History)
2 users (show)

See Also:


Attachments
Jan's patch (8.95 KB, patch)
2013-01-17 07:41 UTC, Steve Singer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description AP 2012-11-20 20:10:35 UTC
I'm using Slony 2.2.0b1 (tarball) with PostgreSQL 9.2.

iservices is the database
ipostoffice is the schema
postoffices is the table
potype_t is the domain/type and it's defined in the ipostoffice schema

The slony user does not have ipostoffice in its search_path.

When replication is attempted the following hits PostgreSQL:

[slony@iservices] ERROR:  42704: type "potype_t" does not exist at character 104
[slony@iservices] QUERY:  INSERT INTO "ipostoffice"."postoffices" ("id", "postoffice", "potype") VALUES ($1::int4, $2::text, $3::potype_t);
[slony@iservices] CONTEXT:  COPY sl_log_1, line 1: "1   50213   23001   1       ipostoffice     postoffices     I       0       {id,2,postoffice,w.x.y.z,potype,hosted}"
[slony@iservices] LOCATION:  typenameType, parse_type.c:204

Problem here is that $3::potype_t /really/ needs to be $3::ipostoffice.potype_t.

The following, though, work:

insert into postoffices (id,postoffice,potype) values (3,'w.x.y.z','hosted'); works where the user has the schema in their path
insert into ipostoffice.postoffices (id,postoffice,potype) values (4,'w.x.y.zz','hosted'); where the user does not
insert into ipostoffice.postoffices (id,postoffice,potype) values (5,'w.x.y.zzz','hosted'); works as the slony user (which does not)

This setup works fine with 2.0.3rc3 and PostgreSQL 8.3.
Comment 1 Jan Wieck 2012-12-14 10:32:36 UTC
Proposed fix by handling the cast inside of the apply trigger the same way, PL/pgSQL is doing type casting internally.

https://github.com/wieck/slony1-engine/commit/47c6f3876a66c4f461ff044080db37e124401847
Comment 2 AP 2013-01-02 21:19:27 UTC
(In reply to comment #1)
> https://github.com/wieck/slony1-engine/commit/47c6f3876a66c4f461ff044080db37e124401847

Ok. I may be being dumb but... how do I download that as a patch? :)
Comment 3 Steve Singer 2013-01-17 07:41:28 UTC
Created attachment 156 [details]
Jan's patch

Attach is the patch that Jan posted on github