Blog Archives

Upgrade Postgres minor version on Ubuntu

I am not a DBA, but recently I have to upgrade Postrges minor version with a security update. This is not either a tutorial or some best practice, but some small snippet of the command you will need, before doing

Tagged with: ,
Posted in Databases, Postgres

Connecting Matlab to Postgres database

Assumptions My primary focus is not on Matlab, but I used it for a while in the Uni. I have to support connecting Matlab installed on Windows machine with Postgres 9.2 database. I used the Matlab command window, so this

Tagged with: ,
Posted in Postgres

Convert column to geometry in Postgres

I noticed a column in Postgres which is varchar, but has geo information and should be geometry. Here are short steps to do in order to convert the data in geometry instead of varchar. 1. Rename the column to the_geom_1

Tagged with: ,
Posted in Postgres

Remove duplicate rows from database

This snippet is particularly for Postgres (that database I am currently using and didn’t tested it in other, but should work. At most you have to change the syntax a little). I have to remove duplicated entries for a duplicated_column

Tagged with: , ,
Posted in Databases, Postgres

Reset Postgres primary key sequence

SQL code snippet to reset the primary key sequence in Postgres database table: SELECT setval(‘sequence_name’, 1); UPDATE table_name SET primary_key_id = DEFAULT;

Tagged with: ,
Posted in Databases, Postgres
Sites
Categories
Archives