From: | "Charles Clavadetscher" <clavadetscher(at)swisspug(dot)org> |
---|---|
To: | "'Yogesh Sharma'" <Yogesh1(dot)Sharma(at)nectechnologies(dot)in>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Request to share information regarding errors |
Date: | 2016-11-16 06:44:26 |
Message-ID: | 00c601d23fd4$e6340070$b29c0150$@swisspug.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Good morning
> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Yogesh Sharma
> Sent: Mittwoch, 16. November 2016 07:09
> To: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Request to share information regarding errors
>
> Dear All,
>
> Thanks for your support.
>
> I am using postgresql 9.3.6 rpm in RHEL6 version.
>
> In postgresql logs, I have found below error messages.
> ERROR: null value in column "column name" violates not-null constraint.
You are trying to insert a row in a table that has a not-null constraint on a field.
Find the record that causes the error and include a valid value for the column that has the not null constraint.
> Second error found:
> ERROR: there is no unique constraint matching given keys for referenced table "table2"
> alter table1 table_name add constraint fk_key foreign key (id, phone_id) references table2 (id, phone_id) on delete
> restrict on update restrict;
A foreign key must match the primary key of the table it refers to. So you should create the primary key contraint on table2 using
id and phone_id.
CREATE UNIQUE INDEX table2_pkey ON table2 (id, phone_id);
ALTER TABLE table2 ADD PRIMARY KEY USING INDEX table2_pkey;
After that you should be able to add the foreign key to table1.
Hope this helps.
Charles
> Could you please share the details of these errors and how to resolve these errors from logs.
>
>
> Regards,
> Yogesh
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org) To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
From | Date | Subject | |
---|---|---|---|
Next Message | Yogesh Sharma | 2016-11-16 06:59:21 | Re: Request to share information regarding errors |
Previous Message | Yogesh Sharma | 2016-11-16 06:09:22 | Re: Request to share information regarding errors |