Thread: Alter columntype with pgadmin?

Alter columntype with pgadmin?

From
Walter Haslbeck
Date:
Hi,

now that PostgreSQL 8 supports changing the datatype of a column with 
the 'ALTER TABLE ... ALTER COLUMN ... TYPE new_type [USING ...]' syntax 
it would be great if pgadminIII has an option to do this via GUI.

Are there any efforts to support this feature in pgadminIII?

Walter


Re: Alter columntype with pgadmin?

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-support-owner@postgresql.org
> [mailto:pgadmin-support-owner@postgresql.org] On Behalf Of
> Walter Haslbeck
> Sent: 27 May 2005 09:12
> To: pgadmin-support@postgresql.org
> Subject: [pgadmin-support] Alter columntype with pgadmin?
>
> Hi,
>
> now that PostgreSQL 8 supports changing the datatype of a column with
> the 'ALTER TABLE ... ALTER COLUMN ... TYPE new_type [USING
> ...]' syntax
> it would be great if pgadminIII has an option to do this via GUI.
>
> Are there any efforts to support this feature in pgadminIII?

pgAdmin does support this feature in the 1.3 development series, but I'm
pretty sure it was in 1.2 as well.

Regards, Dave


Re: Alter columntype with pgadmin?

From
Vincent CARON
Date:
on 27/05/2005 10:11 Walter Haslbeck said the following:
> Hi,
> 
> now that PostgreSQL 8 supports changing the datatype of a column with
> the 'ALTER TABLE ... ALTER COLUMN ... TYPE new_type [USING ...]' syntax
> it would be great if pgadminIII has an option to do this via GUI.
> 
> Are there any efforts to support this feature in pgadminIII?
> 
> Walter
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> 
Very good idea!

-- 

GPG Key: http://covoiturage.fr/caron.asc


Re: Alter columntype with pgadmin?

From
Walter Haslbeck
Date:
Hi,

> pgAdmin does support this feature in the 1.3 development series, but I'm
> pretty sure it was in 1.2 as well.

Well, I'm using the latest binary snapshot of the win32-version 
(20050526) and can't find this feature. If I open the propertys for a 
column of e.g. type 'char', the datatype and size input-boxes are greyed 
out. Where can I e.g. change the length of the char from 20 to 30?

Walter



Re: Alter columntype with pgadmin?

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-support-owner@postgresql.org
> [mailto:pgadmin-support-owner@postgresql.org] On Behalf Of
> Walter Haslbeck
> Sent: 27 May 2005 10:48
> Cc: pgadmin-support@postgresql.org
> Subject: Re: [pgadmin-support] Alter columntype with pgadmin?
>
> Hi,
>
> > pgAdmin does support this feature in the 1.3 development
> series, but I'm
> > pretty sure it was in 1.2 as well.
>
> Well, I'm using the latest binary snapshot of the win32-version
> (20050526) and can't find this feature. If I open the propertys for a
> column of e.g. type 'char', the datatype and size input-boxes
> are greyed
> out. Where can I e.g. change the length of the char from 20 to 30?

If there is a suitable cast in the database, then the combo box will be
populated with usable column types and made selectable (try it with
varchar which should be castable). Any other conversion requires the use
of the USING clause to the alter table statement which pgAdmin doesn't
support. Also, from a quick scan of the code it appears that it won't
let you try to change the types of columns referenced in foreign keys.

Regards, Dave.


Re: Alter columntype with pgadmin?

From
Walter Haslbeck
Date:
Hi,

> If there is a suitable cast in the database, then the combo box will be
> populated with usable column types and made selectable (try it with
> varchar which should be castable). Any other conversion requires the use
> of the USING clause to the alter table statement which pgAdmin doesn't
> support. Also, from a quick scan of the code it appears that it won't

OK, I see that a conversion that needs a USING clause is hard to handle 
with the GUI. But changing the size of a char doesn't need USING:

CREATE TABLE t1 ( c1 char(20) );
ALTER TABLE t1 ALTER column c1 TYPE char(30);
ALTER TABLE t1 ALTER column c1 TYPE char(10);

Its also possible (e.g.) to change from CHAR() to INT, (but not vice 
versa) etc. without the USING clause. It would be great if I can do such 
clear conversions with pgadminIII.

> let you try to change the types of columns referenced in foreign keys.

yes, of course, but perhaps you can implement a 'alter type cascade' 
option. (OK, priority -999 :) )

Walter