• Data Warehouse Service

  1. Help Center
  2. Data Warehouse Service
  3. Developer Guide
  4. SQL Reference
  5. DWS and Postgres SQL
  6. DWS, PostgreSQL psql, and libpq

DWS, PostgreSQL psql, and libpq

DWS gsql and PostgreSQL psql

DWS gsql differs from PostgreSQL psql in that the former has made the following changes to enhance security:

  • User passwords cannot be set by running the \password command.
  • The \i+, \ir+, and \include_relative+ commands and the input and output parameter -k are added to encrypt imported and exported files.
  • Historical command lines cannot be printed to files using the \s metacommand.
  • SQL statements related to sensitive operations, such as those containing passwords, are not recorded. Users cannot see such records when they turn pages or press up or down arrow keys to view the SQL history.
  • After a connection is set up, a message is displayed to inform users of password expiration and to show version information.

gsql also has the following functions in addition to psql functions:

  • The output format parameter -r is added. Allows users to adjust the focus by pressing the Tab key or arrow keys when entering commands.
  • The \parallel metacommand is added to improve execution performance.
  • The \set RETRY statement is added to support retry upon statement errors.
  • Slashes (/) are used as default terminators at the end of PL/SQL statements (such as those used for creating or replacing a function or procedure) for convenience.


During the development of certain DWS functions, such as the gsql client connection tool, PostgreSQL libpq is greatly modified. However, the libpq interface is not verified in application development scenarios. You are not advised to use this set of interfaces for application development, because underlying risks probably exist. You can use the ODBC or JDBC interface instead.