PostgreSQL

When you install PostgreSQL, by default connection to the database using TCP/IP is not allowed.

When you try to connect from a client to a remote PostgreSQL database using psql command, you might get “psql: could not connect to server: Connection refused” error message.

In the following example, from a client machine, we are trying to connect to a PostgreSQL database that is running on 192.168.102.1 server. As you see from the output, it clearly says that the remote PostgreSQL database is not accepting connection.
(more…)

Most of you are already familiar with SQL database, and have a good knowledge on either MySQL, Oracle, or other SQL databases. In the last several years, NoSQL database is getting widely adopted to solve various business problems.

It is helpful to understand the difference between SQL and NoSQL database, and some of available NoSQL database that you can play around with.
(more…)

PostgreSQL Trigger Tutorial with EMP Table Examples

by SathiyaMoorthy on October 6, 2010

Question: I have created triggers in Oracle database. But, I’m new to PostgreSQL. Can you explain me how to create a trigger in Postgres with proper examples?

Answer: A trigger can be used to execute a function when an event (insert, or delete, or update) occurs in a table. Let us review how to create a trigger with an example.
(more…)

8 PostgreSQL Date and Time Function Examples

by Balakrishnan Mariyappan on July 8, 2010

In this article, let us review following PostgreSQL date and time functions with practical examples.

  • now()
  • now()::date
  • now()::time
  • date_part()
  • age()
  • extract()
  • date_trunc()
  • to_char()
  • to_timestamp()

(more…)

Question: How do I executed PostgreSQL Commands inside a Linux / UNIX shell script?

Answer: With the help of the psql interactive terminal, you can execute the psql commands from the shell script. For this purpose, you should enable the password less login by pg_hba.conf, or .pgpass.
(more…)

15 Advanced PostgreSQL Commands with Examples

by SathiyaMoorthy on May 21, 2009

postgreSQL DB
Some of the open source application comes with postgreSQL database. To maintain those application, companies may not hire a fulltime postgreSQL DBA. Instead they may request the existing Oracle DBA, or Linux system administrator, or programmers to maintain the potgreSQL. In this article let discuss about the 15 practical postgresql database commands which will be useful to both DBA and expert psql users.

Also, refer to our previous article about 15 Practical PostgreSQL DBA Commands.
(more…)

15 Practical PostgreSQL Database Administration Commands

by Ramesh Natarajan on April 16, 2009

PostgreSQL DBA Commands
Earlier we discussed about how to install PostgreSQL database on Linux from source.

In this article, let us review top 15 practical postgreSQL DBA command examples.

If you are a mySQL administrator, check-out our 15 examples of mysqladmin command article that we discussed a while back.


(more…)

PostgreSQL Installation and Configuration Steps
Similar to mySQL, postgreSQL is very famous and feature packed free and open source database.

Earlier we’ve discussed several installations including LAMP stack installation, Apache2 installation from source, PHP5 installation from source and mySQL installation.

In this article, let us review how to install postgreSQL database on Linux from source code.

(more…)