From: | Yan Cheng Cheok <yccheok(at)yahoo(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Is this the warning message I should pay attention on it, during table partition |
Date: | 2010-02-02 03:40:47 |
Message-ID: | 740794.70467.qm@web65707.mail.ac4.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I am implementing table partition.
-- There is reason behind why we do not want to use trigger technique for table unit.
-- Please refer to : http://archives.postgresql.org/pgsql-general/2010-01/msg01184.php
-- INSERT INTO unit(fk_lot_id, cycle)
-- VALUES(_lotID, _cycle) RETURNING unit_id INTO _unit_id;
unit_table_index = _lotID;
unit_table_name = 'unit_' || _lotID;
IF NOT EXISTS(SELECT * FROM information_schema.tables WHERE table_name = unit_table_name) THEN
EXECUTE 'CREATE TABLE ' || quote_ident(unit_table_name) || '
(
unit_id bigserial NOT NULL,
fk_lot_id bigint NOT NULL,
CHECK (fk_lot_id = ' || (unit_table_index) || '),
CONSTRAINT pk_unit_' || unit_table_index || '_id PRIMARY KEY (unit_id),
CONSTRAINT fk_lot_' || unit_table_index || '_id FOREIGN KEY (fk_lot_id) REFERENCES lot (lot_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CASCADE
) INHERITS (unit);';
EXECUTE 'CREATE INDEX fk_lot_' || unit_table_index || '_id_idx ON ' || quote_ident(unit_table_name) || '(fk_lot_id);';
END IF;
EXECUTE 'INSERT INTO ' || quote_ident(unit_table_name) || '(fk_lot_id, cycle) VALUES (' || _lotID || ',' || _cycle || ') RETURNING unit_id'
INTO _unit_id;
_unit.unit_id = _unit_id;
_unit.fk_lot_id = _lotID;
_unit.cycle = _cycle;
However, I always get the following message, when there is a new table need to be created.
NOTICE: CREATE TABLE will create implicit sequence "unit_2_unit_id_seq" for serial column "unit_2.unit_id"
CONTEXT: SQL statement "CREATE TABLE unit_2
(
unit_id bigserial NOT NULL,
fk_lot_id bigint NOT NULL,
CHECK (fk_lot_id = 2),
CONSTRAINT pk_unit_2_id PRIMARY KEY (unit_id),
CONSTRAINT fk_lot_2_id FOREIGN KEY (fk_lot_id) REFERENCES lot (lot_id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE CAS
CADE
) INHERITS (unit);"
PL/pgSQL function "insert_unit" line 29 at EXECUTE statement
NOTICE: merging column "unit_id" with inherited definition
Is this the warning message I should take any action on it? If not, how I can suppress it? It is quite annoying, when I saw these message keep printing out from my c++ console.
Thanks and Regards
Yan Cheng CHEOK
From | Date | Subject | |
---|---|---|---|
Next Message | Grzegorz Jaśkiewicz | 2010-02-02 08:11:06 | Re: Is this the warning message I should pay attention on it, during table partition |
Previous Message | Yan Cheng Cheok | 2010-02-02 03:38:19 | Use Trigger to Remove Table itself when there is no row after delete |