Search Postgresql Archives

Re: Request to share information regarding errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Good morning

> -----Original Message-----
> From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of Yogesh Sharma
> Sent: Mittwoch, 16. November 2016 07:09
> To: pgsql-general@xxxxxxxxxxxxxx
> Subject: Re:  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@xxxxxxxxxxxxxx) To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux