From: | Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com> |
---|---|
To: | Pierre BOIZOT <pierre(dot)boizot(at)gmail(dot)com> |
Cc: | PG-Mail-liste <pgsql-fr-generale(at)postgresql(dot)org> |
Subject: | Re: Retour sur Insert |
Date: | 2018-06-12 15:02:04 |
Message-ID: | 39737572-d045-27f2-49ea-2b96632086d5@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-fr-generale |
Oui, mais il faut insérer dans la vue. Comme ceci:
CREATE TABLE x_root (id bigserial PRIMARY KEY, valeur text);
CREATE TABLE x_blah (CHECK (valeur = 'blah')) INHERITS (x_root);
CREATE TABLE x_bling (CHECK (valeur = 'bling')) INHERITS (x_root);
CREATE TRIGGER qui_va_bien BEFORE INSERT ON x_root ...;
CREATE VIEW x AS TABLE x_root;
ALTER VIEW x ALTER COLUMN id SET DEFAULT nextval('x_root_id_seq');
INSERT INTO x (valeur) VALUES ('bling');
On 12/06/18 14:04, Pierre BOIZOT wrote:
> Hello Vik,
>
> J'avais mal lu ta réponse.
>
> J'ai bien un table partitionnée avec la définition des colonnes et des
> tables partitions héritant des définitions.
>
> Nous faisons bien l'insertion dans table parttionnée et les données
> s'insert bien dans la bonne partition.
>
> Le probleme que nous rencontrons c'est l'info en retour sur l'insert qui
> nous renvoie INSERT 0 0
> alors que la ligne est insérée correctement.
>
> Pierre
>
>
> Le ven. 8 juin 2018 à 17:43, Pierre BOIZOT <pierre(dot)boizot(at)gmail(dot)com
> <mailto:pierre(dot)boizot(at)gmail(dot)com>> a écrit :
>
> Merci , je testerai lundi.
>
> Pierre.
>
>
> Le jeu. 7 juin 2018 à 18:38, Vik Fearing
> <vik(dot)fearing(at)2ndquadrant(dot)com <mailto:vik(dot)fearing(at)2ndquadrant(dot)com>> a
> écrit :
>
> On 07/06/18 18:03, Pierre BOIZOT wrote:
> > Hello,
> >
> > Lors d'une insertion dans une table partitionée le retour
> n'est pas le
> > nombre de row inseré mais la valeur 0.
> >
> > Y a t il un parametre particulier à positionner pour résoudre
> un tel cas ?
>
> À moins de passer à la version 10, il faut créer une vue (qui
> est tout
> simplement TABLE ta_table_partitionnee) et insérer dans la vue.
>
> Attention à donner à la vue les valeurs par défaut aussi
> (notamment des
> séquences s'il y en a).
> --
> Vik Fearing +33 6 46 75
> 15 36
> http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et
> Support
>
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
From | Date | Subject | |
---|---|---|---|
Next Message | Vik Fearing | 2018-06-14 11:38:14 | Re: Fwd: Retour sur Insert |
Previous Message | ROS Didier | 2018-06-12 14:19:11 | Migration Oracle vers PostgreSQL impossible avec ora2pg |