You have to set a default value.
ALTER TABLE mytable ADD COLUMN mycolumn character varying(50) NOT NULL DEFAULT 'foo';
... some work (set real values as you want)...
ALTER TABLE mytable ALTER COLUMN mycolumn DROP DEFAULT;
More Related Contents:
- How do I alter the position of a column in a PostgreSQL database table?
- Does PostgreSQL support “accent insensitive” collations?
- PostgreSQL: running count of rows for a query ‘by minute’
- Split comma separated column data into additional columns
- IN vs ANY operator in PostgreSQL
- How to delete duplicate entries?
- Transpose latest rows per user to columns
- Split column into multiple rows in Postgres
- Compute percents from SUM() in the same SELECT sql query
- Getting date list in a range in PostgreSQL
- Postgres Dynamic Query Function
- How do I delete a fixed number of rows with sorting in PostgreSQL?
- What is the equivalent PostgreSQL syntax to Oracle’s CONNECT BY … START WITH?
- sqlite alter table add MULTIPLE columns in a single statement
- Error: Column does not exist
- DROP FUNCTION without knowing the number/type of parameters?
- Multiple array_agg() calls in a single query
- PostgreSQL does not accept column alias in WHERE clause
- Calculate working hours between 2 dates in PostgreSQL
- How to show row numbers in PostgreSQL query?
- How do I ALTER a PostgreSQL table and make a column unique?
- Find records where join doesn’t exist
- Counting the number of occurrences of a substring within a string in PostgreSQL
- Upsert with a transaction
- psql invalid command \N while restore sql
- To ignore duplicate keys during ‘copy from’ in postgresql
- How to include excluded rows in RETURNING from INSERT … ON CONFLICT
- Join a count query on generate_series() and retrieve Null values as ‘0’
- Store and reuse value returned by INSERT … RETURNING
- SQL SET DEFAULT not working in MS Access