PostgreSQL is an open source, highly functional and popular relational database. Here are points to note when using PostgreSQL.

Settings required for PostgreSQL 9.1 or later

From PostgreSQL 9.1, a specification change that does not escape SQL backslashes was done. Therefore, when using from Wagby, please change the setting file postgresql.conf as follows.

standard_conforming_strings = off
escape_string_warning = off

Please restart PostgreSQL after changing the configuration file.

This makes it possible to have the same behavior as the previous PostgreSQL.

When it does not correspond

At run time an error message similar to the following is logged:

[ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelperlogExceptions] ERROR: エスケープシーケンスが無効です  ヒント: エスケープ文字は空か1文字でなければなりません。

Confirm whether the setting was reflected correctly

Execute the following SQL from pgAdmin or psql to confirm the setting.

show standard_conforming_strings;

If the output result is "off", the setting change is reflected.

The type specified by Wagby is handled as follows in the database.

Integer type int4
String type varchar(255)
String type (text area) text (1GB)
Date type date
Time type time
Date Time Type timestamp
File type (file name) varchar(255)
1 byte integer int2
2 byte integer int2
4 byte integer int4
8 byte integer int8
4 byte floating point number float4
8 byte floating point number float8
Fixed value (creation date/update date) timestamp
Other (URL type/mail address type etc.) varchar(255)
The number specified by varchar type is "byte" or "character" unit.It depends on the character encoding of the table to be created.With SQL_ASCII, byte unit, UNICODE, SJIS, EUC_JP will be in character units.Please check the PostgreSQL manual for details.


Since PostgreSQL 9.1.0, the default value of standard_conforming_strings in postgresql.conf has been changed to on.

If you leave the default, you will get an error when referring to the character string, so please change the setting value and escape_string_warning to off.