Обсуждение: Is this the warning message I should pay attention on it, during table partition

Поиск
Список
Период
Сортировка

Is this the warning message I should pay attention on it, during table partition

От
Yan Cheng Cheok
Дата:
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
ONUPDATE 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
DELETECAS 
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
sawthese message keep printing out from my c++ console. 

Thanks and Regards
Yan Cheng CHEOK





Re: Is this the warning message I should pay attention on it, during table partition

От
Grzegorz Jaśkiewicz
Дата:
 SET client_min_messages = error;

Re: Is this the warning message I should pay attention on it, during table partition

От
Alban Hertroys
Дата:
On 2 Feb 2010, at 4:40, Yan Cheng Cheok wrote:

> 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
Isaw these message keep printing out from my c++ console. 


Those are informational messages. You can change what level of messages your application gets by changing the setting
'client_min_messages'either globally or in your C++ program. Apparently it's currently set to the 'notice' level or
lower,you probably want to set that to 'warning' or maybe even higher. 

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,4b6824cc10441094912516!