
Zitat von
yayo
Hallo,
ist das möglich, dass man ein primary key column von int to char ändert? und wie?
danke für die Hilfe
Yayo
Code:
test=# create table yayo (id int primary key);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "yayo_pkey" for table "yayo"
CREATE TABLE
Time: 265,349 ms
test=*# copy yayo from stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>> 1
>> 2
>> 3
>> \.
Time: 3209,832 ms
test=*# alter table yayo alter column id type text using (id::text);
ALTER TABLE
Time: 30,619 ms
test=*# \d yayo
Table "public.yayo"
Column | Type | Modifiers
--------+------+-----------
id | text | not null
Indexes:
"yayo_pkey" PRIMARY KEY, btree (id)
test=*# select * from yayo ;
id
----
1
2
3
(3 rows) Andreas
Lesezeichen