Thread: drop constraint unnamed?
How do you drop an unnamed constraint from a table? I tried searching the archives but the site is extremely slow and I need to get this fixed now. I have tried alter table table drop constraint <unnamed>; alter table table drop constraint '<unnamed>'; alter table table drop constraint ''; alter table table drop constraint; drop trigger triggerName from table; drop trigger 'triggerName' from table; Any ideas? thx andy
ALTER TABLE table RENAME TO aaa; CREATE TABLE table ( columns ..... ) Do it without the constraint INSERT INTO table (SELECT * FROM aaa); DROP TABLE aaa; This is how i would do it although there could be other options HTH On Mon, 14 Oct 2002, Andy Kriger wrote: > How do you drop an unnamed constraint from a table? I tried searching the > archives but the site is extremely slow and I need to get this fixed now. > > I have tried > alter table table drop constraint <unnamed>; > alter table table drop constraint '<unnamed>'; > alter table table drop constraint ''; > alter table table drop constraint; > drop trigger triggerName from table; > drop trigger 'triggerName' from table; > > Any ideas? > > thx > andy > > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > -- Darren Ferguson
"Andy Kriger" <akriger@greaterthanone.com> writes: > How do you drop an unnamed constraint from a table? Is this a foreign-key constraint? If so, you have to drop the three triggers that implement it; see the recipe on the techdocs.postgresql.org site. (7.3 will have a more reasonable way to drop FK constraints ...) regards, tom lane
Unless there are foreign keys and all sorts of other dependencies. As Tom said, the recipe on http://techdocs.postgresql.org/ is much nicer to deal with. Greg ----- Original Message ----- From: "Darren Ferguson" <darren@crystalballinc.com> To: "Andy Kriger" <akriger@greaterthanone.com> Cc: "Pgsql-General" <pgsql-general@postgresql.org> Sent: Monday, October 14, 2002 11:23 AM Subject: Re: [GENERAL] drop constraint unnamed? > ALTER TABLE table RENAME TO aaa; > > CREATE TABLE table ( > columns ..... > ) > > Do it without the constraint > > INSERT INTO table (SELECT * FROM aaa); > > > DROP TABLE aaa; > > This is how i would do it although there could be other options > > HTH > > On Mon, 14 Oct 2002, Andy Kriger wrote: > > > How do you drop an unnamed constraint from a table? I tried searching the > > archives but the site is extremely slow and I need to get this fixed now. > > > > I have tried > > alter table table drop constraint <unnamed>; > > alter table table drop constraint '<unnamed>'; > > alter table table drop constraint ''; > > alter table table drop constraint; > > drop trigger triggerName from table; > > drop trigger 'triggerName' from table; > > > > Any ideas? > > > > thx > > andy > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 2: you can get off all lists at once with the unregister command > > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > > > -- > Darren Ferguson > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly
Hi All, I need some help to migrate data from MSSQL to Postgres. I have the following a scnirio like. 1.I have a table in MSSQL. 2.I have another table in Postgres with different name and schema from the one which is present in MSSQL. Is it possible to migrate data from the table which is present in MSSQL to Postgres. - Best Regards - Savita ---------------------------------------------------- Hewlett Packard (India) +91 80 2051288 (Phone) 847 1288 (HP Telnet) ----------------------------------------------------
On 26 Nov 2002 at 10:53, Savita wrote: > Hi All, > > I need some help to migrate data from MSSQL to Postgres. > > I have the following a scnirio like. > > 1.I have a table in MSSQL. > 2.I have another table in Postgres with different name and schema from the one > which is present in MSSQL. > > Is it possible to migrate data from the table which is present in MSSQL to > Postgres. Obviously there are some commanalities between these two.. Some little scripts in sed and awk might get you the text formatting needed for interoperation. Text dump from one table and text load to other is the only way I can think.. HTH Bye Shridhar -- Random, n.: As in number, predictable. As in memory access, unpredictable.
On Tue, 26 Nov 2002, Savita wrote: > Hi All, > > I need some help to migrate data from MSSQL to Postgres. > > I have the following a scnirio like. > > 1.I have a table in MSSQL. > 2.I have another table in Postgres with different name and schema from the one > which is present in MSSQL. > > Is it possible to migrate data from the table which is present in MSSQL to > Postgres. Sure. But I'm not sure what you're asking exactly. Are you wanting to move data from tablea in the MSSQL to tablea in Postgresql, even though they have different schema? Or do you want to make a new tableb in Postgresql to take in the data from tablea in MSSQL? Or maybe a new database so you can use the name tablea from MSSQL in Postgresql? Generally, I've found it pretty easy to use ODBC and open a connection to each database and then just 'select * from sourcetable' and the iterate over the result set and build a whole bunch of 'insert into desttable (f1,f2,f3,...fn) values ('v1','v2','v3',...'vn');' and wrap them up in a begin;commit; pair. The other method is to dump the data to a text file on the MSSQL side and then use /copy to suck the data in. Both are pretty fast in my experience, but the /copy is a little faster than the inserts.