Use the ADD CONSTRAINT or DROP CONSTRAINT clause with the ALTER TABLE command to add or drop a primary key constraint from a Postgres table.
Education
Professional Postgres and Open Source support
Command Prompt, Inc., is the oldest Postgres Company in North America and one of the oldest Open Source firms still operating today. We serve our clients with best in class expertise and professionalism. You can read more about support and services here:
- Postgres Support
- PgLTS: Extended Support for EOL Postgres
- Open Source Full Stack Support
- Try the latest PgManage (Open Source) and get rid of PgAdmin!
You have landed at the largest single source of Postgres education blogs in the world. At Command Prompt, we believe deeply that the education of the community is critical to the continued success of Postgres and related technologies. We hope you find content you are looking for and don't hesitate to Contact us today for all your Postgres and Open Source consulting and support needs.
How Do I Backup a PostgreSQL Database
Postgres offers a couple of standard tools/utilities, such as pg_dump and pg_dumpall, to back up a single or all databases.
How to Connect To PostgreSQL Database Server Using Python
Install “psycopg2” module, import it into your python program, and use the connect() function of “psycopg2” module to connect to the Postgres database server via python.
PostgreSQL ARRAY_APPEND() Function With Examples
Postgres provides an ARRAY_APPEND() function that is used to append/add elements at the end of the array. It accepts two parameters: an array and an element to be appended.
How to Get First Non-Null Value in PostgreSQL
To get the first non-null value in Postgres, an inbuilt function named COALESCE() is used. It accepts the “n” number of arguments and retrieves the first non-null value.
PostgreSQL OFFSET Clause With Practical Examples
In PostgreSQL, the OFFSET clause is used to skip some records before returning the result set of a query. By default, the OFFSET clause skipped the records from the top.
How to Compare Two Tables Using EXCEPT Operator in PostgreSQL
In PostgreSQL, the EXCEPT operator is used to compare multiple tables. It executes two SELECT queries and retrieves only those records that are not available in the second SELECT query.
PostgreSQL NOW() Function With Practical Examples
In Postgres, the NOW() function retrieves the current date and time along with the time zone(based on the database server’s setting).
How to Get Table Size in PostgreSQL
PostgreSQL provides a pg_relation_size() function to get the size of a particular table. The “pg_size_pretty()” function is used to get the table’s size in a human-readable format like KBs, MBs.
PostgreSQL CURRENT_DATE Function With Practical Examples
CURRENT_DATE is one of the Postgres built-in date functions that retrieve the current/today’s date. It doesn’t take any argument.