From: Igor Kryltsov <kryltsov@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: Postgresql FK to MS SQL triggers
Date: Mon, 28 Feb 2005 16:46:55 +1100
Message-ID: <cvub0o$1sll$2@news.hub.org> (raw)
Hi,
If you are moving from Postgres to MS SQL you will most likely will find
that you can not recreate your PostgreSQL FK to MSSQL FK because this
enterprise class database will NOT allow you to create all 3 FK which are
exist in your PGSQL:
table users(user_id PK)
table journal(created_by, modified_by, deleted_by)
ADD CONSTRAINT fk_created_by FOREIGN KEY (created_by) REFERENCES
users(user_id) MATCH FULL ON UPDATE
CASCADE ON DELETE CASCADE;
ADD CONSTRAINT fk_modified_by FOREIGN KEY (modified_by) REFERENCES
users(user_id) MATCH FULL ON UPDATE
CASCADE ON DELETE CASCADE;
ADD CONSTRAINT fk_deleted_by FOREIGN KEY (deleted_by) REFERENCES
users(user_id) MATCH FULL ON UPDATE
CASCADE ON DELETE CASCADE;
For interested people I wrote a PHP script which:
1) Extracts all underlying triggers from pg_trigger table in Postgres used
to support FK (3 triggers for each FK)
2) Generates a MSSQL script file which recreates all triggers in MSSQL
Hope it will save some time for somebody.
Igor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: kryltsov@yahoo.com
Subject: Re: Postgresql FK to MS SQL triggers
In-Reply-To: <cvub0o$1sll$2@news.hub.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox