Inherit from tables to one main table - Mailing list pgsql-novice

From si24
Subject Inherit from tables to one main table
Date
Msg-id 1378466797410-5769870.post@n5.nabble.com
Whole thread Raw
Responses Re: Inherit from tables to one main table
List pgsql-novice
Hi I'm new to PostgreSQL and basically have started working with and am
learning as I go along.

I seem to be having a slight Issue with the inherit part of the postgre.
I am currently trying to get 9 different tables into one main table so that
it can be read through geoserver instead of the 9 going through geoserver.

CREATE TABLE data."Test" (
  "OID" integer NOT NULL DEFAULT nextval('data."Test"'::regclass),
  "CMAID" integer,
  "UpdateDate" timestamp without time zone,
  "SG21CODE" character varying(21),
  "ErfExtent" integer,
  "ZoneBlocked" smallint,
  "MunValue" integer,
  "MunValueYear" integer,
  "PurchasePrice" integer,
  "PurchaseDate" timestamp without time zone,
  "RegisteredDate" timestamp without time zone,
  "ReportedSalePrice" integer,
  "ReportedSaleDate" timestamp without time zone,
  "BondHolder" character varying(32),
  "BondAmount" bigint,
  "DateIncluded" timestamp without time zone,
  "SchemeNo" money,
  geometry geometry(Geometry,3857),
  "EUCat" text,
  "UseCode" text,
  "MUNCODE" text,
  "SGUSAGE" text,
  "ZoneDesc" text,
  "Remainder" text,
  "SiteOnly" text,
  "RegStatus" text,
  "Buyer" text,
  "SaleStatus" text,
  "SaleType" text,
  "TitleDeed" text,
  "PostCode" text,
  "Address4" text,
  "Address3" text,
  "Address2" text,
  "Address1" text,
  "Ratepayer" text,
  "OwnerIDNo" text,
  "Owner" text,
  "Zone" text,
  "ErfUsage" text,
  "Type" text,
  "Suburb" text,
  "SubSuburb" text,
  "Complex" text,
  "StreetName" text,
  "Allotment" text,
  "StreetNo" text,
  "SchemeName" text,
  "ErfNo" text,
  version integer)

 INHERITS
(data."WC",data."NW",data."NC",data."MP",data."LP",data."KZN",data."GP",data."FS",data."EC");

 SELECT *
 FROM data."Test"

I have managed to create the main table for all 9 tables to go into but it
does not seem to show any information. How do I get the data from the 9
tables into this main table. Am I missing something that I forgot to add to
it or do I need a trigger of some sort in it. At a later date this table has
to pick up any changes from any of the nine tables or all of the tables and
be updated as it goes along. Would the trigger be a useful thing to use so
that it will fix these issues. I have never used triggers so I'm not a 100%
sure how to go about doing that.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Inherit-from-tables-to-one-main-table-tp5769870.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.


pgsql-novice by date:

Previous
From: James David Smith
Date:
Subject: Re: Writing results while loop ongoing?
Next
From: Samrat Revagade
Date:
Subject: Re: Inherit from tables to one main table