pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedALTER TABLE for field modify...
6+ messages / 3 participants
[nested] [flat]
* ALTER TABLE for field modify...
@ 2002-05-02 20:27 MG <makgab@freemail.hu>
0 siblings, 1 reply; 6+ messages in thread
From: MG @ 2002-05-02 20:27 UTC (permalink / raw)
To: pgsql-admin
Hi!
How can I modify a field of table with ALTER TABLE? I want to modify the
constraint. The TABLE is now:
"ID" int8 NOT NULL, UNIQUE
But I want this:
"ID" int8 REFERENCE "table2"
THanx!
Bye!
-----------------
Linux RedHat 7.1
-----------------
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ALTER TABLE for field modify...
@ 2002-05-03 19:07 Nick Fankhauser <nickf@ontko.com>
parent: MG <makgab@freemail.hu>
0 siblings, 2 replies; 6+ messages in thread
From: Nick Fankhauser @ 2002-05-03 19:07 UTC (permalink / raw)
To: MG <makgab@freemail.hu>; pgsql-admin
alter table <tablename> drop constraint ID unique;
alter table <tablename> drop constraint ID not null;
alter table <tablename> add constraint ID references table2 ;
Here is where you can find the documentation for this:
The "alter":
http://www.postgresql.org/idocs/index.php?sql-altertable.html
The constraints:
http://www.postgresql.org/idocs/index.php?sql-createtable.html
regards,
-Nick
--------------------------------------------------------------------------
Nick Fankhauser nickf@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788
Ray Ontko & Co. Software Consulting Services http://www.ontko.com/
> -----Original Message-----
> From: pgsql-admin-owner@postgresql.org
> [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of MG
> Sent: Thursday, May 02, 2002 3:28 PM
> To: PostgreSQL List
> Subject: [ADMIN] ALTER TABLE for field modify...
>
>
>
> Hi!
>
> How can I modify a field of table with ALTER TABLE? I want to modify the
> constraint. The TABLE is now:
> "ID" int8 NOT NULL, UNIQUE
>
> But I want this:
> "ID" int8 REFERENCE "table2"
>
>
> THanx!
> Bye!
> -----------------
> Linux RedHat 7.1
> -----------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ALTER TABLE for field modify...
@ 2002-05-10 15:33 MG <makgab@freemail.hu>
parent: Nick Fankhauser <nickf@ontko.com>
1 sibling, 0 replies; 6+ messages in thread
From: MG @ 2002-05-10 15:33 UTC (permalink / raw)
To: Nick Fankhauser <nickf@ontko.com>; +Cc: pgsql-admin
On 03-May-2002 Nick Fankhauser wrote:
> alter table <tablename> drop constraint ID unique;
> alter table <tablename> drop constraint ID not null;
>
> alter table <tablename> add constraint ID references table2 ;
>
Hi!
It not works... :(
How can I change the properties of a field?
Bye!
-----------------
Linux RedHat 7.1
-----------------
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ALTER TABLE for field modify...
@ 2002-05-14 16:24 MG <makgab@freemail.hu>
parent: Nick Fankhauser <nickf@ontko.com>
1 sibling, 1 reply; 6+ messages in thread
From: MG @ 2002-05-14 16:24 UTC (permalink / raw)
To: pgsql-admin
On 03-May-2002 Nick Fankhauser wrote:
> alter table <tablename> drop constraint ID unique;
> alter table <tablename> drop constraint ID not null;
>
> alter table <tablename> add constraint ID references table2 ;
>
Hi!
It not works. :(
I try it:
proba=# create table "tabla1" ("ID" int8 NOT NULL UNIQUE, "nev" varchar(20) );
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'tabla1_ID_key' for
table 'tabla1'
CREATE
proba=# create table "tabla2" ("ID2" int8 NOT NULL UNIQUE, "nev2" varchar(20) );
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'tabla2_ID2_key' for
table 'tabla2'
CREATE
proba=# alter table tabla1 drop constraint ID not null;
ERROR: parser: parse error at or near "not"
-------------------------------------------
What is the problem?
Bye!
-----------------
Linux RedHat 7.1
-----------------
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ALTER TABLE for field modify...
@ 2002-05-14 20:52 David Stanaway <david@stanaway.net>
parent: MG <makgab@freemail.hu>
0 siblings, 1 reply; 6+ messages in thread
From: David Stanaway @ 2002-05-14 20:52 UTC (permalink / raw)
To: MG <makgab@freemail.hu>; +Cc: pgsql-admin
On Tue, 2002-05-14 at 11:24, MG wrote:
>
> On 03-May-2002 Nick Fankhauser wrote:
> > alter table <tablename> drop constraint ID unique;
> > alter table <tablename> drop constraint ID not null;
> >
> > alter table <tablename> add constraint ID references table2 ;
> >
>
> Hi!
>
> It not works. :(
> I try it:
> proba=# create table "tabla1" ("ID" int8 NOT NULL UNIQUE, "nev" varchar(20) );
> NOTICE: CREATE TABLE/UNIQUE will create implicit index 'tabla1_ID_key' for
> table 'tabla1'
In this case the row is ID (Case sensitive) so whenever you refer to it
you must refer to it as "ID"
> CREATE
> proba=# create table "tabla2" ("ID2" int8 NOT NULL UNIQUE, "nev2" varchar(20) );
> NOTICE: CREATE TABLE/UNIQUE will create implicit index 'tabla2_ID2_key' for
> table 'tabla2'
> CREATE
>
> proba=# alter table tabla1 drop constraint ID not null;
Here you refer to it as ID which is case folded to id and does not refer
to the column named ID.
I don't know if that is your problem, but it is one problem with your
code. and it will no doubt show up in many more places.
--
David Stanaway
Attachments:
signature.asc (application/pgp-signature, 523B) download
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: ALTER TABLE for field modify...
@ 2002-05-15 06:41 MG <makgab@freemail.hu>
parent: David Stanaway <david@stanaway.net>
0 siblings, 0 replies; 6+ messages in thread
From: MG @ 2002-05-15 06:41 UTC (permalink / raw)
To: pgsql-admin
David Stanaway <david@stanaway.net> wrote:
> In this case the row is ID (Case sensitive) so whenever
> you refer to it you must refer to it as "ID"
> ...
>
> > proba=# alter table tabla1 drop constraint ID not null;
>
> Here you refer to it as ID which is case folded to id and
> does not refer to the column named ID.
>
I tried it with "ID", but it doesn't work neither. :(
Why? What should I do?
THanx!
Bye!
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2002-05-15 06:41 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-05-02 20:27 ALTER TABLE for field modify... MG <makgab@freemail.hu>
2002-05-03 19:07 ` Nick Fankhauser <nickf@ontko.com>
2002-05-10 15:33 ` MG <makgab@freemail.hu>
2002-05-14 16:24 ` MG <makgab@freemail.hu>
2002-05-14 20:52 ` David Stanaway <david@stanaway.net>
2002-05-15 06:41 ` MG <makgab@freemail.hu>
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