Re: Converting between UUID and VARCHAR - Mailing list pgsql-sql

From Helio Campos Mello de Andrade
Subject Re: Converting between UUID and VARCHAR
Date
Msg-id 29e3942f0811281427w45e42c15h6f05f9fd1a5b92fd@mail.gmail.com
Whole thread Raw
In response to Re: Converting between UUID and VARCHAR  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
List pgsql-sql
Didn't you create those other tables with "character varying" too? If
you did i think that you need to change those tables too.

On Mon, Nov 10, 2008 at 12:44 PM, A. Kretschmer
<andreas.kretschmer@schollglas.com> wrote:
> am  Mon, dem 10.11.2008, um 15:34:10 +0100 mailte Mario Splivalo folgendes:
>> I have a table, like this:
>>
>> CREATE TABLE t1
>> (
>>   u1 character varying
>> )
>>
>> And some data inside:
>>
>> INSERT INTO t1 (u1) VALUES ('62d6b434-7dfd-4b3b-b1bf-87f6c20c10dd');
>> INSERT INTO t1 (u1) VALUES ('e3fee596-164b-4995-9e0d-7b2a79e83752');
>>
>> Now, I can do this:
>>
>> SELECT u1::uuid FROM t1;
>>
>> But I can't do this:
>>
>> ALTER TABLE t1 ALTER u1 TYPE uuid;
>
> test=# CREATE TABLE t1
> test-# (
> test(#   u1 character varying
> test(# )
> test-# ;
> CREATE TABLE
> test=# INSERT INTO t1 (u1) VALUES
> ('62d6b434-7dfd-4b3b-b1bf-87f6c20c10dd');
> INSERT 0 1
> test=# alter table t1 alter column u1 type uuid using u1::uuid;
> ALTER TABLE
> test=# \d t1;
>     Table "public.t1"
>  Column | Type | Modifiers
> --------+------+-----------
>  u1     | uuid |
>
>
>
> Andreas
> --
> Andreas Kretschmer
> Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
> GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>



-- 
Helio Campos Mello de Andrade


pgsql-sql by date:

Previous
From: Lennin Caro
Date:
Subject: Re: wired behaviour
Next
From: Milan Oparnica
Date:
Subject: Re: JOIN results of refcursor functions