I'd like to alter an existing table to add a column which defines a large string as default in Postgres DB.
I have tried the following:
DO $$
declare PARAGRAPH character varying(4000):= 'Large text in here, around 4000 characters';
begin
ALTER TABLE USERS
ADD COLUMN NOTES_TEXT character varying(4000) DEFAULT PARAGRAPH NOT NULL;
END $$;
Another way I found is the following:
DO $$
declare PARAGRAPH character varying(4000);
begin
select 'Very large text goes in here.' into PARAGRAPH;
ALTER TABLE USERS
ADD COLUMN NOTES_TEXT character varying(4000) DEFAULT PARAGRAPH NOT NULL;
END $$;
However, I am getting errors in both attempts related to the variable not recognized.
Do you know if this is possible in Postgres?
Thanks a lot
PARAGRAPH character varying(2000)and then'Large text in here, around 4000 characters';, See the problem?