Thread: create remote table with sort of index...

create remote table with sort of index...

From
"Al-Haddad, Mohammad J"
Date:
 
Dear All,
 
I have a database schema consist of 3 table, I located them in 3 different workstations (Ethernet LAN) each has psql 7.1. (trying to do some parallel experiments):
 
the first table A, has a primary key say A.att1    (created and allocated correctly, in the first workstation)
the second table B, has primary key say B.att2 (created and allocated correctly, in the second workstation)
the third table C, has 2 Foreign key which are referenced to table A.att1 and B.att2
 
I have tried to create table C with those attributes as primary but I failed
create table C_ (c_att1 int4, c_att2 int4, c_att3 int4, c_att4 int4 CONSTRAINT PRIMARY KEY
(c_att1 , c_att2));    
(because of the attribute duplication)
 
Dose any one has suggestion how to create C tale with sort of indexing...?
 
Thak you
 
Kind Regards
 
Mohammed alhaddad
Department of Computer Science
University of Essex
Wivenhoe Park
Colchester CO4 3SQ
Room 3.402
+44 1206 87 2038

rename a table name

From
Bai Yan
Date:
Hello all,

I am new for postgresql and have a big bunch of problems.

I create a table named 'action-test' but now I want to change the name to
'action', ALTER TALBE command doesn't help and I didn't find a command as
'rename'.

How can I create a table copied from another table, say, both have the same
structure and content?

Thanks a lot,

Yan Bai



Re: rename a table name

From
"Joel Burton"
Date:
joel=# \h alter table
Command:     ALTER TABLE
Description: change the definition of a table
Syntax:
ALTER TABLE [ ONLY ] table [ * ]
    ADD [ COLUMN ] column type [ column_constraint [ ... ] ]
ALTER TABLE [ ONLY ] table [ * ]
    ALTER [ COLUMN ] column { SET DEFAULT value | DROP DEFAULT }
ALTER TABLE [ ONLY ] table [ * ]
    ALTER [ COLUMN ] column SET STATISTICS integer
ALTER TABLE [ ONLY ] table [ * ]
    ALTER [ COLUMN ] column SET STORAGE {PLAIN | EXTERNAL | EXTENDED | MAIN}
ALTER TABLE [ ONLY ] table [ * ]
    RENAME [ COLUMN ] column TO newcolumn
ALTER TABLE table
    RENAME TO new_table
ALTER TABLE table
    ADD table_constraint_definition
ALTER TABLE [ ONLY ] table
        DROP CONSTRAINT constraint { RESTRICT | CASCADE }
ALTER TABLE table
        OWNER TO new_owner


... unless you're using an old version of PG.

Joel BURTON | joel@joelburton.com | joelburton.com | aim: wjoelburton
Knowledge Management & Technology Consultant

> -----Original Message-----
> From: pgsql-novice-owner@postgresql.org
> [mailto:pgsql-novice-owner@postgresql.org]On Behalf Of Bai Yan
> Sent: Tuesday, March 19, 2002 12:57 AM
> To: pgsql-novice@postgresql.org
> Subject: [NOVICE] rename a table name
>
>
> Hello all,
>
> I am new for postgresql and have a big bunch of problems.
>
> I create a table named 'action-test' but now I want to change the name to
> 'action', ALTER TALBE command doesn't help and I didn't find a command as
> 'rename'.
>
> How can I create a table copied from another table, say, both
> have the same
> structure and content?
>
> Thanks a lot,
>
> Yan Bai
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>