Child pages
  • PostgreSQL Primer

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For example on Centos/RHEL you will find the database cluster in 

Code Block
/var/lib/pgsql/12/data/

and the binary in 

Code Block
/usr/pgsql-12/bin/


Starting PostgreSQL

Using the bundled PostgreSQL (assuming you run this from within the application_server directory):

...

After you installed Servoy and PostgreSQL you might find that PostgreSQL is not running.

This usually could be mean 2 things:

  • PostgreSQL wasn't yet initialised. In other words there is no cluster created yet to host the databases. This means that the database or data directory is empty.
  • There is another PostgreSQL instance running on port 5432 (PostgreSQL's standard port)

...

PostgreSQL doesn't do automatic casting of types. This means that when sending in parameters into a prepared statement, it is up to the developer to make sure to send in the right type.

For example:

Code Block
languagejs
var value = 1;
var query = "SELECT * FROM table WHERE textcolumn = ?"
var args = new Array();
args[0] = value;
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, args, maxReturnedRows);

Has to become:

Code Block
languagejs
var value = 1;
var query = "SELECT * FROM table WHERE textcolumn = ?"
var args = new Array();
args[0] = value + ""; //forcing the integer value to become a string
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, args, maxReturnedRows);

...

Quoting for column Aliasses:

Code Block
languagesql
SELECT some_column as "A nice name" FROM table

Quoting literal strings:

Code Block
languagesql
SELECT * FROM table where text_column = 'someValue'

...