Import SQL file using pgAdmin

Posted in IT StuffTagged

I have a docker Postgres image and I want to import the data from another Postgres db. The first thing I have done is to create a pg_dump on the remote server and then I have tried to import it. The problem is that output generated is simple SQL file and, if I import this….

Quit from psql command-line utility

Posted in IT StuffTagged

To quit from Postgres psql command-line utility use: health_coach=# \qhealth_coach=# \q and press enter

Use of LIKE clause in sql prepared statement

Posted in IT StuffTagged , ,

Suppose you have a where condition with like clause: AND ( UPPER(C.ndg) LIKE UPPER(’%test%’) OR UPPER(C.ndg_name) LIKE UPPER(’%test%’) )and ( UPPER(C.ndg) like UPPER(‘%test%’) or UPPER(C.ndg_name) like UPPER(‘%test%’) ) on Java you should write something like that: AND ( UPPER(C.ndg) LIKE UPPER(’%?%’) OR UPPER(C.ndg_name) LIKE UPPER(’%?%’) )and ( UPPER(C.ndg) like UPPER(‘%?%’) or UPPER(C.ndg_name) like UPPER(‘%?%’) )….

Run Postgres 9.1 on MacOS Lion as Daemon

Posted in IT StuffTagged ,

To start a new Postgres version as Daemon you need to follow these commands. For first, unload current version (if available): sudo launchctl unload /Library/LaunchDaemons/org.postgresql.dbms.plistsudo launchctl unload /Library/LaunchDaemons/org.postgresql.dbms.plist Edit theĀ org.postgresql.dbms.plist (if not available, create a new one): <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.postgresql.postgres</string> <key>ProgramArguments</key> <array>….