Archive for the 'Databases' Category

How to delete/drop a constraint in PostgresSQL

This article will show you how to drop a contraint, such as a foreign key contraint, on a PostgresSQL 8.x database.

Login to the PostgresSQL command-line interface
psql -U [username] [database_name]
Show a list of constraints on a particular table
\d [table_name]
To Delete (or Drop) the constraint, use the command:
ALTER TABLE [table_name] DROP CONSTRAINT [constraint_name];

Click here to read the full post

How to parse a decimal number using ‘awk’ and ‘cut’ in Linux

This article will show you how to parse a decimal number (such as a software release number) into individual parts. For example, you can do this if you need to compare the the minor release number of two versions. There are numerous ways to accomplish the same thing using Linux and I will show you [...]

Click here to read the full post

How to install a FTP server on Linux in 30 seconds

This article will show you how to install a FTP server (vsftpd) on Linux in under 30 seconds.
Installing a FTP Server on Linux
yum -y install vsftpd
After the installation is complete, you must start the FTP server by running the command:
service start vsftpd
Thats all there is to it! A couple things to note:

The default username [...]

Click here to read the full post

How to install,upgrade, and uninstall a Linux RPM package

This article will show you to how install,upgrade, and uninstall a RPM package on Linux. For additional RPM commands such as listing all installed RPMs on the box and detailed package information such as version, date created, file listing, etc. check out How to Find All Installed RPMs in Linux.
To install a RPM
rpm -ivh [package [...]

Click here to read the full post

Find PostgreSQL database size using SQL ‘Select’

This article will show you a very simple way to find the size of a PostgreSQL database using a SQL SELECT statement. This will work on PostgreSQL version 8.3.3, but should work on older versions as well.
Query
SELECT pg_database.datname,pg_size_pretty(pg_database_size(pg_database.datname)) AS size FROM pg_database where datname=’database_name’;
Sample Result
datname | size
—————–+——-
database_name | 15 MB
(1 [...]

Click here to read the full post