pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Postgresql FK to MS SQL triggers
2+ messages / 2 participants
[nested] [flat]

* Postgresql FK to MS SQL triggers
@ 2005-02-28 05:46 Igor Kryltsov <kryltsov@yahoo.com>
  2005-03-05 22:04 ` Re: Postgresql FK to MS SQL triggers Josh Berkus <josh@agliodbs.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Igor Kryltsov @ 2005-02-28 05:46 UTC (permalink / raw)
  To: pgsql-sql

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






^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Postgresql FK to MS SQL triggers
  2005-02-28 05:46 Postgresql FK to MS SQL triggers Igor Kryltsov <kryltsov@yahoo.com>
@ 2005-03-05 22:04 ` Josh Berkus <josh@agliodbs.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Josh Berkus @ 2005-03-05 22:04 UTC (permalink / raw)
  To: Igor Kryltsov <kryltsov@yahoo.com>; +Cc: pgsql-sql

Igor,

> 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

How about a script which goes the other way?

-- 
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-03-05 22:04 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-02-28 05:46 Postgresql FK to MS SQL triggers Igor Kryltsov <kryltsov@yahoo.com>
2005-03-05 22:04 ` Josh Berkus <josh@agliodbs.com>

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