user2504767
user2504767

Reputation:

How to set an endless character Datatype in a Postgres Database table?

I have this database table in postgres:

CREATE TABLE dummytable (
     id bigint NOT NULL,
     fieldvalue character varying(255)
)

How can i changed the datatype of the field "fieldvalue" to an endless character datatype? Is that possible?

Upvotes: 0

Views: 83

Answers (2)

Clodoaldo Neto
Clodoaldo Neto

Reputation: 125454

Use the text data type

CREATE TABLE dummytable (
     id bigint NOT NULL,
     fieldvalue text
)

To alter an existent table

alter table dummytable
alter column fieldvalue
set data type text;

Upvotes: 1

NiiL
NiiL

Reputation: 2827

ALTER TABLE dummytable ALTER COLUMN fieldvalue TYPE TEXT;

For more ALTER TABLE option see this link: PostgreSQL - Alter Table

Upvotes: 0

Related Questions