Craig Ringer wrote:
Richard Huxton wrote:
DELETE FROM table1 WHERE col1 NOT IN (SELECT id from table2);
Just as a side note: If you have a large number of missing IDs and don't
want to wait a long time, you may be better off with something like
(untested, but I think it's right - TEST
Richard Huxton wrote:
> DELETE FROM table1 WHERE col1 NOT IN (SELECT id from table2);
Just as a side note: If you have a large number of missing IDs and don't
want to wait a long time, you may be better off with something like
(untested, but I think it's right - TEST FIRST):
SELECT *
FROM table1
Igor Katson wrote:
> I am doing an ALTER TABLE to create a foreign key, however with some
> rows i get:
>
> insert or update on table "name" violates foreign key constraint
> "name_fkey"
>
> How can I just drop the conflicting rows while doing that?
You can't automatically. You can do something
I am doing an ALTER TABLE to create a foreign key, however with some
rows i get:
insert or update on table "name" violates foreign key constraint "name_fkey"
How can I just drop the conflicting rows while doing that?
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make