Re: [pgadmin-support] hi

From: frank_lupo <frank_lupo(at)email(dot)it>
To: oceanlz <oceanlz(at)yahoo(dot)com(dot)cn>
Cc: pgsql-sql-owner <pgsql-sql-owner(at)postgresql(dot)org>
Subject: Re: [pgadmin-support] hi
Date: 2002-10-21 06:32:41
Message-ID: H4BJIH$6B77EB74DB3CB62F7784C8865BB32BC2@email.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>i don't send mail to pgsql-sql(at)postgresql(dot)org,but i need help
>how to migrate sql from MS sql server to postgresql?
>i'd like to tranfer sql schema from MS server
>Example:
>*******************1*********************************
>if exists (select * from sysobjects
>where id = object_id(N'[admin].[test]') and
>OBJECTPROPERTY(id, N'IsUserTable') = 1)
>drop table [admin].[test]
>go
>*******************2*********************************
>CREATE TABLE [admin].[test] (
>[test_name] [char] (50) NOT NULL ,
>[test_value] [int] NOT NULL
>)
> i can only realize part 2. i don't know how to realize part 1.in other words,
>i want to know how to check if a table exist in postgresql
>*******************2*********************************
> create table test(
> test_name char (50) not null,
> test_value int not null
> )
>thanks for any advice!!
>
>Do You Yaho
o!?
=0
A
>"·¢¶ÌÐÅÓ®ÊÖ»ú,¿ìÀ´²Î¼ÓÑÅ»¢¾ÞÐÇÐã!"

For verify if a tbella it exists they can use catalogues of postgresql.
The table is pg_class.
Relname e' the name of the table
Relkind type object ' r' =table
Relowner owner object
select relname from pgclass where relkind='r' and relname='test' and pg_get_userbyid(relowner) = 'admin'

Bye !!
Frank Lupo (Wolf) !!

Browse pgsql-general by date

  From Date Subject
Next Message Patrick Fiche 2002-10-21 08:15:46 problem after REINDEX command
Previous Message Tom Lane 2002-10-21 04:46:45 Re: PLPGSQL - Trigger Insert acting strange