Change Existing Column to Serial in Postgres

In order to change an existing column in a Postgres table to a serial column where the ID autoincrements, you need to: 1) Create the SEQUENCE that is used behind the scenes. 2) Assign the SEQUENCE to the COLUMN 3) Find the value the SEQUENCE should start from 4)...

Postgres Upsert On Conflict Where Clause

A basic example of a Postgres Upsert using “on conflict do update” with a where clause.    Postgres Upsert ON CONFLICT with WHERE clause create table z_test( f1 text PRIMARY KEY, f2 text, f3 text, f4 text ); insert into z_test (f1,f2,f3,f4)...

Location of PostgresSQL Data Files Windows 7

I recently lost my motherboard but still had a functional HDD. I wanted to re-install Postgres once I got my new machine but needed to continue to use the existing data files from my Postgres database. The data files were in a custom location that I could not recall....

Pin It on Pinterest