Обсуждение: ALTER TYPE my_enum AS ENUM ADD ('label10')

Поиск
Список
Период
Сортировка

ALTER TYPE my_enum AS ENUM ADD ('label10')

От
Andreas Gaab
Дата:
<div class="Section1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Times New Roman","serif"">Hi
all,</span><pclass="MsoNormal"><span style="font-size:11.0pt;font-family:"Times New Roman","serif""> </span><p
class="MsoNormal"><spanlang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif"">I start working with
enumeratortypes and I am wondering, if my enumerator can later be adjusted. E.g. if I would like to add another
label.</span><pclass="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New
Roman","serif""> </span><pclass="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New
Roman","serif"">Isit allowed just to add another entry to pg_enum? How is the enumerator then sorted (i.e. enum_last()
)?</span><pclass="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New
Roman","serif""> </span><pclass="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New
Roman","serif"">Isit possible to alter the labels of an enumerator later on? Can I edit pg_enum?</span><p
class="MsoNormal"><spanlang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif""> </span><p
class="MsoNormal"><spanlang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif"">Thanks
already,</span><pclass="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New
Roman","serif"">AndreasGaab</span><p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times
NewRoman","serif""> </span><p class="MsoNormal"><span
style="font-size:10.0pt">___________________________________________________________________________</span><p
class="MsoNormal"><spanstyle="font-size:10.0pt"> </span><p class="MsoNormal"><span
style="font-size:10.0pt">SCANLAB AG</span><pclass="MsoNormal"><span
style="font-size:10.0pt">Dr. Andreas Simon Gaab</span><pclass="MsoNormal"><span style="font-size:10.0pt">Entwicklung •
R & D</span><pclass="MsoNormal"><span style="font-size:10.0pt"> </span><p class="MsoNormal"><span
style="font-size:10.0pt">Siemensstr. 2a• 82178 Puchheim • Germany</span><p class="MsoNormal"><span
style="font-size:10.0pt">Tel. +49 (89) 800 746-513• Fax +49 (89) 800 746-199</span><p class="MsoNormal"><span
style="font-size:10.0pt"><ahref="mailto:a.gaab@scanlab.de">mailto:a.gaab@scanlab.de</a> • <a
href="http://www.scanlab.de">www.scanlab.de</a></span><pclass="MsoNormal"><span style="font-size:10.0pt"> </span><p
class="MsoNormal"><spanstyle="font-size:10.0pt">Amtsgericht München: HRB 124707 • USt-IdNr.: DE 129 456 351</span><p
class="MsoNormal"><spanstyle="font-size:10.0pt">Vorstand: Georg Hofner (Sprecher), Christian Huttenloher,
Norbert Petschik</span><pclass="MsoNormal"><span style="font-size:10.0pt">Aufsichtsrat (Vorsitz):
Dr. Hans J. Langer</span><pclass="MsoNormal"><span
style="font-size:10.0pt">___________________________________________________________________________</span><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif""></span><pclass="MsoNormal"> </div> 

Re: ALTER TYPE my_enum AS ENUM ADD ('label10')

От
"A. Kretschmer"
Дата:
In response to Andreas Gaab :
> Hi all,
> 
>  
> 
> I start working with enumerator types and I am wondering, if my enumerator can
> later be adjusted. E.g. if I would like to add another label.

AFAIK you can't. Each enum is a own type. Use a lookup-table instead and
use enum's only for real static things.


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99


Re: ALTER TYPE my_enum AS ENUM ADD ('label10')

От
"A. Kretschmer"
Дата:
In response to Andreas Gaab :
> I tried successfully to directly insert a further entry into table
> pg_enum with the corresponding enumtypid. Do you think to directly
> manipulate table pg_enum is allowed?

It's maybe allowed, but not recommended. It's a system-table, not a
user-table.


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99