mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	with OPAQUE, as per recent pghackers discussion. I still want to do some more work on the 'cstring' pseudo-type, but I'm going to commit the bulk of the changes now before the tree starts shifting under me ...
		
			
				
	
	
		
			43 lines
		
	
	
		
			972 B
		
	
	
	
		
			SQL
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			972 B
		
	
	
	
		
			SQL
		
	
	
	
	
	
 | 
						|
CREATE FUNCTION "recordchange" () RETURNS trigger AS
 | 
						|
'/usr/local/pgsql/lib/pending.so', 'recordchange' LANGUAGE 'C';
 | 
						|
 | 
						|
CREATE TABLE "MirrorHost" (
 | 
						|
"MirrorHostId" serial,
 | 
						|
"HostName" varchar NOT NULL
 | 
						|
);
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
CREATE TABLE "Pending" (
 | 
						|
"SeqId" serial,
 | 
						|
"TableName" varchar NOT NULL,
 | 
						|
"Op" character,
 | 
						|
"XID" int4 NOT NULL,
 | 
						|
PRIMARY KEY ("SeqId")
 | 
						|
 | 
						|
);
 | 
						|
 | 
						|
CREATE INDEX "Pending_XID_Index" ON "Pending" ("XID");
 | 
						|
 | 
						|
CREATE TABLE "PendingData" (
 | 
						|
"SeqId" int4 NOT NULL,
 | 
						|
"IsKey" bool NOT NULL,
 | 
						|
"Data" varchar,
 | 
						|
PRIMARY KEY ("SeqId", "IsKey") ,
 | 
						|
FOREIGN KEY ("SeqId") REFERENCES "Pending" ("SeqId") ON UPDATE CASCADE  ON DELETE CASCADE
 | 
						|
);
 | 
						|
 | 
						|
 | 
						|
CREATE TABLE "MirroredTransaction" (
 | 
						|
"XID" int4 NOT NULL,
 | 
						|
"LastSeqId" int4 NOT NULL,
 | 
						|
"MirrorHostId" int4 NOT NULL,
 | 
						|
PRIMARY KEY  ("XID","MirrorHostId"),
 | 
						|
FOREIGN KEY ("MirrorHostId") REFERENCES "MirrorHost" ("MirrorHostId") ON UPDATE CASCADE ON DELETE CASCADE,
 | 
						|
FOREIGN KEY ("LastSeqId") REFERENCES "Pending" ("SeqId")  ON UPDATE
 | 
						|
CASCADE ON DELETE CASCADE
 | 
						|
);
 |