Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create enums using pgAdmin?

I am using pgAdmin ver 1.18.1 for PostgreSQL 9.3. I want to create an enum but could not find any option in the GUI to do the same. Tried searching pgAdmin documentation as well but could not find anything.

Does pgAdmin not support creation of enums? If yes, then why and how it should be done then?

Thanks.

like image 973
AAgg Avatar asked Sep 28 '14 12:09

AAgg


People also ask

Can we use enum in PostgreSQL?

PostgreSQL enum is the data type that was used in PostgreSQL to stored same type of values in column field, we can store same type of values using enum.

What is enum in Postgres?

Enumerated (enum) types are data types that comprise a static, ordered set of values. They are equivalent to the enum types supported in a number of programming languages. An example of an enum type might be the days of the week, or a set of status values for a piece of data.

Where are enums stored Postgres?

Postgres stores Enums in the pg_type catalog.


2 Answers

I fired up a copy of pgadmin and noticed what you said, I couldn't see my 'types'. If you pull down the main menu and go to preferences, then scroll down until you see Type, then check the box and refresh you screen, then types become visible.

like image 187
Greg Avatar answered Sep 19 '22 15:09

Greg


Just Create "type" in types option which is located in the schema section.While creating type just select enumeration type and fill your value in label

enter image description here

like image 30
Mohd Tauovir Khan Avatar answered Sep 20 '22 15:09

Mohd Tauovir Khan