PostgreSQL Notes


OS X: How to start / stop Postgre SQL Server on OS X. This may work on other flavors of linux also.

  1. Enable the root user (
  2. Open a terminal window.
  3. Type “su” and press enter. Enter the password to login as root.
  4. Type “su – postgres” to login as postgres
  5. cd to /<install_dir>/PostgreSQL/9.0/bin
  6. type ./pg_ctl stop -D /<install_dir>/PostgreSQL/9.0/data

I’m open to suggestions for an easier way.

Insert where not exists

This method is not specific to Postgre and should work with any database.

INSERT INTO table1 (field1,field2)
SELECT 'value1','value2' WHERE NOT EXISTS
(SELECT field1,field2 FROM table1 WHERE field1 = 'value1' AND field2 = 'value2');


 Posted by at 4:50 pm

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>