Package org.postgresql.jdbc

# Class PgConnection

java.lang.Object
org.postgresql.jdbc.PgConnection

All Implemented Interfaces:
  `AutoCloseable`, `Connection`, `Wrapper`, `BaseConnection`, `PGConnection`

public class PgConnection extends Object implements BaseConnection

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `class`
  `PgConnection.AbortCommand`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected int`
  `defaultFetchSize`
  Default fetch size for statement.
  `protected boolean`
  `forcebinary`
  `protected @Nullable DatabaseMetaData`
  `metadata`
  `protected int`
  `prepareThreshold`
  `protected Map<String,Class<?>>`
  `typemap`
  The current type mappings.

  ### Fields inherited from interface java.sql.Connection

  `TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PgConnection(HostSpec[] hostSpecs, Properties info, String url)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `abort()`
  `void`
  `abort(Executor executor)`
  `void`
  `addDataType(String type, Class<? extends PGobject> klass)`
  This allows client code to add a handler for one of org.postgresql's more unique data types.
  `void`
  `addDataType(String type, String name)`
  Deprecated.
  `void`
  `addTimerTask(TimerTask timerTask, long milliSeconds)`
  Schedule a TimerTask for later execution.
  `void`
  `addWarning(SQLWarning warn)`
  This adds a warning to the warning chain.
  `boolean`
  `binaryTransferSend(int oid)`
  Returns true if value for the given oid should be sent using binary transfer.
  `void`
  `cancelQuery()`
  Cancel the current query executing on this connection.
  `protected void`
  `checkClosed()`
  `void`
  `clearWarnings()`
  `void`
  `close()`
  Note: even though `Statement` is automatically closed when it is garbage collected, it is better to close it explicitly to lower resource consumption.
  `void`
  `commit()`
  `Array`
  `createArrayOf(String typeName, @Nullable Object elements)`
  Creates an `Array` wrapping elements.
  `Array`
  `createArrayOf(String typeName, @Nullable Object @Nullable [] elements)`
  `Blob`
  `createBlob()`
  `Clob`
  `createClob()`
  `NClob`
  `createNClob()`
  `CachedQuery`
  `createQuery(String sql, boolean escapeProcessing, boolean isParameterized, String... columnNames)`
  `<T> T`
  `createQueryObject(Class<T> ifc)`
  `SQLXML`
  `createSQLXML()`
  `Statement`
  `createStatement()`
  `Statement`
  `createStatement(int resultSetType, int resultSetConcurrency)`
  `Statement`
  `createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)`
  `Struct`
  `createStruct(String typeName, Object[] attributes)`
  `protected TypeInfo`
  `createTypeInfo(BaseConnection conn, int unknownLength)`
  `byte @PolyNull []`
  `encodeString(@PolyNull String str)`
  Encode a string using the database's client_encoding (usually UTF8, but can vary on older server versions).
  `String`
  `escapeIdentifier(String identifier)`
  Return the given string suitably quoted to be used as an identifier in an SQL statement string.
  `String`
  `escapeLiteral(String literal)`
  Return the given string suitably quoted to be used as a string literal in an SQL statement string.
  `String`
  `escapeString(String str)`
  Escapes a string for use as string-literal within an SQL command.
  `ResultSet`
  `execSQLQuery(String s)`
  Execute a SQL query that returns a single resultset.
  `ResultSet`
  `execSQLQuery(String s, int resultSetType, int resultSetConcurrency)`
  `void`
  `execSQLUpdate(String s)`
  Execute a SQL query that does not return results.
  `boolean`
  `getAdaptiveFetch()`
  Get state of adaptive fetch for connection.
  `boolean`
  `getAutoCommit()`
  `AutoSave`
  `getAutosave()`
  Connection configuration regarding automatic per-query savepoints.
  `int`
  `getBackendPID()`
  Return the process ID (PID) of the backend server process handling this connection.
  `String`
  `getCatalog()`
  `Properties`
  `getClientInfo()`
  `@Nullable String`
  `getClientInfo(String name)`
  `boolean`
  `getConvertBooleanToNumeric()`
  Returns true if boolean values should be converted to numeric types (1/0).
  `CopyManager`
  `getCopyAPI()`
  This returns the COPY API for the current connection.
  `@Nullable String`
  `getCursorName()`
  getCursorName gets the cursor name.
  `String`
  `getDBVersionNumber()`
  Get server version number.
  `int`
  `getDefaultFetchSize()`
  Get the default fetch size for statements created from this connection.
  `Encoding`
  `getEncoding()`
  `Fastpath`
  `getFastpathAPI()`
  This returns the Fastpath API for the current connection.
  `LruCache<FieldMetadata.Key,FieldMetadata>`
  `getFieldMetadataCache()`
  Return metadata cache for given connection.
  `boolean`
  `getForceBinary()`
  `boolean`
  `getHideUnprivilegedObjects()`
  `int`
  `getHoldability()`
  `protected @Nullable String`
  `getIsolationLevelName(int level)`
  `LargeObjectManager`
  `getLargeObjectAPI()`
  This returns the LargeObject API for the current connection.
  `Logger`
  `getLogger()`
  `boolean`
  `getLogServerErrorDetail()`
  Indicates if error details from server used in included in logging and exceptions.
  `DatabaseMetaData`
  `getMetaData()`
  `int`
  `getNetworkTimeout()`
  `PGNotification[]`
  `getNotifications()`
  This method returns any notifications that have been received since the last call to this method.
  `PGNotification[]`
  `getNotifications(int timeoutMillis)`
  This method returns any notifications that have been received since the last call to this method.
  `Object`
  `getObject(String type, @Nullable String value, byte @Nullable [] byteValue)`
  This method is used internally to return an object based around org.postgresql's more unique data types.
  `final @Nullable String`
  `getParameterStatus(String parameterName)`
  Shorthand for getParameterStatuses().get(...) .
  `final Map<String,String>`
  `getParameterStatuses()`
  Returns the current values of all parameters reported by the server.
  `PreferQueryMode`
  `getPreferQueryMode()`
  Returns the query mode for this connection.
  `int`
  `getPrepareThreshold()`
  Get the default server-side prepare reuse threshold for statements created from this connection.
  `ProtocolVersion`
  `getProtocolVersion()`
  `QueryExecutor`
  `getQueryExecutor()`
  Get the QueryExecutor implementation for this connection.
  `PGReplicationConnection`
  `getReplicationAPI()`
  `ReplicationProtocol`
  `getReplicationProtocol()`
  Internal protocol for work with physical and logical replication.
  `@Nullable String`
  `getSchema()`
  `int`
  `getServerMajorVersion()`
  Get server major version.
  `int`
  `getServerMinorVersion()`
  Get server minor version.
  `boolean`
  `getStandardConformingStrings()`
  Returns whether the server treats string-literals according to the SQL standard or if it uses traditional PostgreSQL escaping rules.
  `boolean`
  `getStringVarcharFlag()`
  `TimestampUtils`
  `getTimestampUtils()`
  Deprecated.
  `int`
  `getTransactionIsolation()`
  `TransactionState`
  `getTransactionState()`
  Get the current transaction state of this connection.
  `TypeInfo`
  `getTypeInfo()`
  `Map<String,Class<?>>`
  `getTypeMap()`
  `String`
  `getURL()`
  We are required to bring back certain information by the DatabaseMetaData class.
  `String`
  `getUserName()`
  Method getUserName() brings back the User Name (again, we saved it).
  `@Nullable SQLWarning`
  `getWarnings()`
  `PGXmlFactoryFactory`
  `getXmlFactoryFactory()`
  Retrieve the factory to instantiate XML processing factories.
  `boolean`
  `haveMinimumServerVersion(int ver)`
  Check if we have at least a particular server version.
  `boolean`
  `haveMinimumServerVersion(Version ver)`
  Check if we have at least a particular server version.
  `boolean`
  `hintReadOnly()`
  Indicates if statements to backend should be hinted as read only.
  `boolean`
  `isClosed()`
  `boolean`
  `isColumnSanitiserDisabled()`
  Return whether to disable column name sanitation.
  `boolean`
  `isReadOnly()`
  `boolean`
  `isValid(int timeout)`
  `boolean`
  `isWrapperFor(Class<?> iface)`
  `protected Array`
  `makeArray(int oid, @Nullable String fieldString)`
  `protected Blob`
  `makeBlob(long oid)`
  `protected Clob`
  `makeClob(long oid)`
  `protected SQLXML`
  `makeSQLXML()`
  `String`
  `nativeSQL(String sql)`
  `CallableStatement`
  `prepareCall(String sql)`
  `CallableStatement`
  `prepareCall(String sql, int resultSetType, int resultSetConcurrency)`
  `CallableStatement`
  `prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)`
  `PreparedStatement`
  `prepareStatement(String sql)`
  `PreparedStatement`
  `prepareStatement(String sql, int autoGeneratedKeys)`
  `PreparedStatement`
  `prepareStatement(String sql, int @Nullable [] columnIndexes)`
  `PreparedStatement`
  `prepareStatement(String sql, int resultSetType, int resultSetConcurrency)`
  `PreparedStatement`
  `prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)`
  `PreparedStatement`
  `prepareStatement(String sql, String @Nullable [] columnNames)`
  `void`
  `purgeTimerTasks()`
  Invoke purge() on the underlying shared Timer so that internal resources will be released.
  `void`
  `releaseSavepoint(Savepoint savepoint)`
  `void`
  `rollback()`
  `void`
  `rollback(Savepoint savepoint)`
  `void`
  `setAdaptiveFetch(boolean adaptiveFetch)`
  Turn on/off adaptive fetch for connection.
  `void`
  `setAutoCommit(boolean autoCommit)`
  `void`
  `setAutosave(AutoSave autoSave)`
  Configures if connection should use automatic savepoints.
  `void`
  `setCatalog(String catalog)`
  `void`
  `setClientInfo(String name, @Nullable String value)`
  `void`
  `setClientInfo(Properties properties)`
  `void`
  `setCursorName(String cursor)`
  In SQL, a result table can be retrieved through a cursor that is named.
  `void`
  `setDefaultFetchSize(int fetchSize)`
  Set the default fetch size for statements created from this connection.
  `void`
  `setDisableColumnSanitiser(boolean disableColumnSanitiser)`
  `void`
  `setFlushCacheOnDeallocate(boolean flushCacheOnDeallocate)`
  By default, the connection resets statement cache in case deallocate all/discard all message is observed.
  `void`
  `setForceBinary(boolean newValue)`
  `void`
  `setHoldability(int holdability)`
  `void`
  `setNetworkTimeout(@Nullable Executor executor, int milliseconds)`
  `void`
  `setPrepareThreshold(int newThreshold)`
  Set the default statement reuse threshold before enabling server-side prepare.
  `void`
  `setReadOnly(boolean readOnly)`
  `Savepoint`
  `setSavepoint()`
  `Savepoint`
  `setSavepoint(String name)`
  `void`
  `setSchema(@Nullable String schema)`
  `void`
  `setTransactionIsolation(int level)`
  `void`
  `setTypeMap(Map<String,Class<?>> map)`
  `void`
  `setTypeMapImpl(Map<String,Class<?>> map)`
  `<T> T`
  `unwrap(Class<T> iface)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface java.sql.Connection

  `beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid`

  ### Methods inherited from interface org.postgresql.PGConnection

  `alterUserPassword`

- ## Field Details

  - ### prepareThreshold

    protected int prepareThreshold

  - ### defaultFetchSize

    protected int defaultFetchSize
    Default fetch size for statement.
    See Also:
      - `PGProperty.DEFAULT_ROW_FETCH_SIZE`

  - ### forcebinary

    protected boolean forcebinary

  - ### typemap

    protected Map<String,Class<?>> typemap
    The current type mappings.

  - ### metadata

    protected @Nullable DatabaseMetaData metadata

- ## Constructor Details

  - ### PgConnection

    public PgConnection(HostSpec[] hostSpecs, Properties info, String url) throws SQLException
    Throws:
      `SQLException`

- ## Method Details

  - ### createQuery

    public CachedQuery createQuery(String sql, boolean escapeProcessing, boolean isParameterized, String... columnNames) throws SQLException
    Specified by:
      `createQuery` in interface `BaseConnection`
    Throws:
      `SQLException`

  - ### setFlushCacheOnDeallocate

    public void setFlushCacheOnDeallocate(boolean flushCacheOnDeallocate)
    Description copied from interface: `BaseConnection`
    By default, the connection resets statement cache in case deallocate all/discard all message is observed. This API allows to disable that feature for testing purposes.
    Specified by:
      `setFlushCacheOnDeallocate` in interface `BaseConnection`
    Parameters:
      `flushCacheOnDeallocate` - true if statement cache should be reset when "deallocate/discard" message observed

  - ### getTimestampUtils

    @Deprecated public TimestampUtils getTimestampUtils()
    Deprecated.
    Specified by:
      `getTimestampUtils` in interface `BaseConnection`

  - ### createStatement

    public Statement createStatement() throws SQLException
    Specified by:
      `createStatement` in interface `Connection`
    Throws:
      `SQLException`

  - ### prepareStatement

    public PreparedStatement prepareStatement(String sql) throws SQLException
    Specified by:
      `prepareStatement` in interface `Connection`
    Throws:
      `SQLException`

  - ### prepareCall

    public CallableStatement prepareCall(String sql) throws SQLException
    Specified by:
      `prepareCall` in interface `Connection`
    Throws:
      `SQLException`

  - ### getTypeMap

    public Map<String,Class<?>> getTypeMap() throws SQLException
    Specified by:
      `getTypeMap` in interface `Connection`
    Throws:
      `SQLException`

  - ### getQueryExecutor

    public QueryExecutor getQueryExecutor()
    Description copied from interface: `BaseConnection`
    Get the QueryExecutor implementation for this connection.
    Specified by:
      `getQueryExecutor` in interface `BaseConnection`
    Returns:
      the (non-null) executor

  - ### getReplicationProtocol

    public ReplicationProtocol getReplicationProtocol()
    Description copied from interface: `BaseConnection`
    Internal protocol for work with physical and logical replication. Physical replication available only since PostgreSQL version 9.1. Logical replication available only since PostgreSQL version 9.4.
    Specified by:
      `getReplicationProtocol` in interface `BaseConnection`
    Returns:
      not null replication protocol

  - ### addWarning

    public void addWarning(SQLWarning warn)
    This adds a warning to the warning chain.
    Parameters:
      `warn` - warning to add

  - ### execSQLQuery

    public ResultSet execSQLQuery(String s) throws SQLException
    Description copied from interface: `BaseConnection`
    Execute a SQL query that returns a single resultset. Never causes a new transaction to be started regardless of the autocommit setting.
    Specified by:
      `execSQLQuery` in interface `BaseConnection`
    Parameters:
      `s` - the query to execute
    Returns:
      the (non-null) returned resultset
    Throws:
      `SQLException` - if something goes wrong.

  - ### execSQLQuery

    public ResultSet execSQLQuery(String s, int resultSetType, int resultSetConcurrency) throws SQLException
    Specified by:
      `execSQLQuery` in interface `BaseConnection`
    Throws:
      `SQLException`

  - ### execSQLUpdate

    public void execSQLUpdate(String s) throws SQLException
    Description copied from interface: `BaseConnection`
    Execute a SQL query that does not return results. Never causes a new transaction to be started regardless of the autocommit setting.
    Specified by:
      `execSQLUpdate` in interface `BaseConnection`
    Parameters:
      `s` - the query to execute
    Throws:
      `SQLException` - if something goes wrong.

  - ### setCursorName

    public void setCursorName(String cursor) throws SQLException
    In SQL, a result table can be retrieved through a cursor that is named. The current row of a result can be updated or deleted using a positioned update/delete statement that references the cursor name.

    We do not support positioned update/delete, so this is a no-op.

    Parameters:
      `cursor` - the cursor name
    Throws:
      `SQLException` - if a database access error occurs

  - ### getCursorName

    public @Nullable String getCursorName() throws SQLException
    getCursorName gets the cursor name.
    Returns:
      the current cursor name
    Throws:
      `SQLException` - if a database access error occurs

  - ### getURL

    public String getURL() throws SQLException
    We are required to bring back certain information by the DatabaseMetaData class. These functions do that.

    Method getURL() brings back the URL (good job we saved it)

    Returns:
      the url
    Throws:
      `SQLException` - just in case...

  - ### getUserName

    public String getUserName() throws SQLException
    Method getUserName() brings back the User Name (again, we saved it).
    Returns:
      the user name
    Throws:
      `SQLException` - just in case...

  - ### getFastpathAPI

    public Fastpath getFastpathAPI() throws SQLException
    Description copied from interface: `PGConnection`
    This returns the Fastpath API for the current connection.

    Note: This API is somewhat obsolete, as one may achieve similar performance and greater functionality by setting up a prepared statement to define the function call. Then, executing the statement with binary transmission of parameters and results substitutes for a fast-path function call.

    Specified by:
      `getFastpathAPI` in interface `PGConnection`
    Returns:
      Fastpath API for the current connection
    Throws:
      `SQLException` - if something wrong happens

  - ### getLargeObjectAPI

    public LargeObjectManager getLargeObjectAPI() throws SQLException
    Description copied from interface: `PGConnection`
    This returns the LargeObject API for the current connection.
    Specified by:
      `getLargeObjectAPI` in interface `PGConnection`
    Returns:
      LargeObject API for the current connection
    Throws:
      `SQLException` - if something wrong happens

  - ### getObject

    public Object getObject(String type, @Nullable String value, byte @Nullable [] byteValue) throws SQLException
    This method is used internally to return an object based around org.postgresql's more unique data types.

    It uses an internal HashMap to get the handling class. If the type is not supported, then an instance of org.postgresql.util.PGobject is returned.

    You can use the getValue() or setValue() methods to handle the returned object. Custom objects can have their own methods.

    Specified by:
      `getObject` in interface `BaseConnection`
    Parameters:
      `type` - the backend typename
      `value` - the type-specific string representation of the value
      `byteValue` - the type-specific binary representation of the value
    Returns:
      PGobject for this type, and set to value
    Throws:
      `SQLException` - if value is not correct for this type

  - ### createTypeInfo

    protected TypeInfo createTypeInfo(BaseConnection conn, int unknownLength)

  - ### getTypeInfo

    public TypeInfo getTypeInfo()
    Specified by:
      `getTypeInfo` in interface `BaseConnection`

  - ### addDataType

    @Deprecated public void addDataType(String type, String name)
    Deprecated.
    Description copied from interface: `PGConnection`
    This allows client code to add a handler for one of org.postgresql's more unique data types. It is approximately equivalent to `addDataType(type, Class.forName(name))`.
    Specified by:
      `addDataType` in interface `PGConnection`
    Parameters:
      `type` - JDBC type name
      `name` - class name

  - ### addDataType

    public void addDataType(String type, Class<? extends PGobject> klass) throws SQLException
    Description copied from interface: `PGConnection`
    This allows client code to add a handler for one of org.postgresql's more unique data types.

    NOTE: This is not part of JDBC, but an extension.

    The best way to use this is as follows:

         ...
         ((org.postgresql.PGConnection)myconn).addDataType("mytype", my.class.name.class);
         ...

    where myconn is an open Connection to org.postgresql.

    The handling class must extend org.postgresql.util.PGobject

    Specified by:
      `addDataType` in interface `PGConnection`
    Parameters:
      `type` - the PostgreSQL type to register
      `klass` - the class implementing the Java representation of the type; this class must implement `PGobject`).
    Throws:
      `SQLException` - if `klass` does not implement `PGobject`).
    See Also:
      - `PGobject`

  - ### close

    public void close() throws SQLException
    Note: even though `Statement` is automatically closed when it is garbage collected, it is better to close it explicitly to lower resource consumption. The spec says that calling close on a closed connection is a no-op.
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Connection`
    Throws:
      `SQLException`

  - ### nativeSQL

    public String nativeSQL(String sql) throws SQLException
    Specified by:
      `nativeSQL` in interface `Connection`
    Throws:
      `SQLException`

  - ### getWarnings

    public @Nullable SQLWarning getWarnings() throws SQLException
    Specified by:
      `getWarnings` in interface `Connection`
    Throws:
      `SQLException`

  - ### clearWarnings

    public void clearWarnings() throws SQLException
    Specified by:
      `clearWarnings` in interface `Connection`
    Throws:
      `SQLException`

  - ### setReadOnly

    public void setReadOnly(boolean readOnly) throws SQLException
    Specified by:
      `setReadOnly` in interface `Connection`
    Throws:
      `SQLException`

  - ### isReadOnly

    public boolean isReadOnly() throws SQLException
    Specified by:
      `isReadOnly` in interface `Connection`
    Throws:
      `SQLException`

  - ### hintReadOnly

    public boolean hintReadOnly()
    Description copied from interface: `BaseConnection`
    Indicates if statements to backend should be hinted as read only.
    Specified by:
      `hintReadOnly` in interface `BaseConnection`
    Returns:
      Indication if hints to backend (such as when transaction begins) should be read only.
    See Also:
      - `PGProperty.READ_ONLY_MODE`

  - ### setAutoCommit

    public void setAutoCommit(boolean autoCommit) throws SQLException
    Specified by:
      `setAutoCommit` in interface `Connection`
    Throws:
      `SQLException`

  - ### getAutoCommit

    public boolean getAutoCommit() throws SQLException
    Specified by:
      `getAutoCommit` in interface `Connection`
    Throws:
      `SQLException`

  - ### commit

    public void commit() throws SQLException
    Specified by:
      `commit` in interface `Connection`
    Throws:
      `SQLException`

  - ### checkClosed

    protected void checkClosed() throws SQLException
    Throws:
      `SQLException`

  - ### rollback

    public void rollback() throws SQLException
    Specified by:
      `rollback` in interface `Connection`
    Throws:
      `SQLException`

  - ### getTransactionState

    public TransactionState getTransactionState()
    Description copied from interface: `BaseConnection`
    Get the current transaction state of this connection.
    Specified by:
      `getTransactionState` in interface `BaseConnection`
    Returns:
      current transaction state of this connection

  - ### getTransactionIsolation

    public int getTransactionIsolation() throws SQLException
    Specified by:
      `getTransactionIsolation` in interface `Connection`
    Throws:
      `SQLException`

  - ### setTransactionIsolation

    public void setTransactionIsolation(int level) throws SQLException
    Specified by:
      `setTransactionIsolation` in interface `Connection`
    Throws:
      `SQLException`

  - ### getIsolationLevelName

    protected @Nullable String getIsolationLevelName(int level)

  - ### setCatalog

    public void setCatalog(String catalog) throws SQLException
    Specified by:
      `setCatalog` in interface `Connection`
    Throws:
      `SQLException`

  - ### getCatalog

    public String getCatalog() throws SQLException
    Specified by:
      `getCatalog` in interface `Connection`
    Throws:
      `SQLException`

  - ### getHideUnprivilegedObjects

    public boolean getHideUnprivilegedObjects()

  - ### getDBVersionNumber

    public String getDBVersionNumber()
    Get server version number.
    Returns:
      server version number

  - ### getServerMajorVersion

    public int getServerMajorVersion()
    Get server major version.
    Returns:
      server major version

  - ### getServerMinorVersion

    public int getServerMinorVersion()
    Get server minor version.
    Returns:
      server minor version

  - ### haveMinimumServerVersion

    public boolean haveMinimumServerVersion(int ver)
    Description copied from interface: `BaseConnection`
    Check if we have at least a particular server version.

    The input version is of the form xxyyzz, matching a PostgreSQL version like xx.yy.zz. So 9.0.12 is 90012.

    Specified by:
      `haveMinimumServerVersion` in interface `BaseConnection`
    Parameters:
      `ver` - the server version to check, of the form xxyyzz eg 90401
    Returns:
      true if the server version is at least "ver".

  - ### haveMinimumServerVersion

    public boolean haveMinimumServerVersion(Version ver)
    Description copied from interface: `BaseConnection`
    Check if we have at least a particular server version.

    The input version is of the form xxyyzz, matching a PostgreSQL version like xx.yy.zz. So 9.0.12 is 90012.

    Specified by:
      `haveMinimumServerVersion` in interface `BaseConnection`
    Parameters:
      `ver` - the server version to check
    Returns:
      true if the server version is at least "ver".

  - ### getEncoding

    @Pure public Encoding getEncoding()
    Specified by:
      `getEncoding` in interface `BaseConnection`

  - ### encodeString

    public byte @PolyNull [] encodeString(@PolyNull String str) throws SQLException
    Description copied from interface: `BaseConnection`
    Encode a string using the database's client_encoding (usually UTF8, but can vary on older server versions). This is used when constructing synthetic resultsets (for example, in metadata methods).
    Specified by:
      `encodeString` in interface `BaseConnection`
    Parameters:
      `str` - the string to encode
    Returns:
      an encoded representation of the string
    Throws:
      `SQLException` - if something goes wrong.

  - ### escapeString

    public String escapeString(String str) throws SQLException
    Description copied from interface: `BaseConnection`
    Escapes a string for use as string-literal within an SQL command. The method chooses the applicable escaping rules based on the value of `BaseConnection.getStandardConformingStrings()`.
    Specified by:
      `escapeString` in interface `BaseConnection`
    Parameters:
      `str` - a string value
    Returns:
      the escaped representation of the string
    Throws:
      `SQLException` - if the string contains a `\0` character

  - ### getStandardConformingStrings

    public boolean getStandardConformingStrings()
    Description copied from interface: `BaseConnection`
    Returns whether the server treats string-literals according to the SQL standard or if it uses traditional PostgreSQL escaping rules. Versions up to 8.1 always treated backslashes as escape characters in string-literals. Since 8.2, this depends on the value of the `standard_conforming_strings` server variable.
    Specified by:
      `getStandardConformingStrings` in interface `BaseConnection`
    Returns:
      true if the server treats string literals according to the SQL standard
    See Also:
      - `QueryExecutor.getStandardConformingStrings()`

  - ### isClosed

    public boolean isClosed() throws SQLException
    Specified by:
      `isClosed` in interface `Connection`
    Throws:
      `SQLException`

  - ### cancelQuery

    public void cancelQuery() throws SQLException
    Description copied from interface: `BaseConnection`
    Cancel the current query executing on this connection.
    Specified by:
      `cancelQuery` in interface `BaseConnection`
    Specified by:
      `cancelQuery` in interface `PGConnection`
    Throws:
      `SQLException` - if something goes wrong.

  - ### getNotifications

    public PGNotification[] getNotifications() throws SQLException
    Description copied from interface: `PGConnection`
    This method returns any notifications that have been received since the last call to this method. Returns an empty array if there have been no notifications.
    Specified by:
      `getNotifications` in interface `PGConnection`
    Returns:
      notifications that have been received
    Throws:
      `SQLException` - if something wrong happens

  - ### getNotifications

    public PGNotification[] getNotifications(int timeoutMillis) throws SQLException
    Description copied from interface: `PGConnection`
    This method returns any notifications that have been received since the last call to this method. Returns an empty array if there have been no notifications. A timeout can be specified so the driver waits for notifications.
    Specified by:
      `getNotifications` in interface `PGConnection`
    Parameters:
      `timeoutMillis` - when 0, blocks forever. when > 0, blocks up to the specified number of millis or until at least one notification has been received. If more than one notification is about to be received, these will be returned in one batch.
    Returns:
      notifications that have been received
    Throws:
      `SQLException` - if something wrong happens

  - ### getPrepareThreshold

    public int getPrepareThreshold()
    Description copied from interface: `PGConnection`
    Get the default server-side prepare reuse threshold for statements created from this connection.
    Specified by:
      `getPrepareThreshold` in interface `PGConnection`
    Returns:
      the current threshold

  - ### setDefaultFetchSize

    public void setDefaultFetchSize(int fetchSize) throws SQLException
    Description copied from interface: `PGConnection`
    Set the default fetch size for statements created from this connection.
    Specified by:
      `setDefaultFetchSize` in interface `PGConnection`
    Parameters:
      `fetchSize` - new default fetch size
    Throws:
      `SQLException` - if specified negative `fetchSize` parameter
    See Also:
      - `Statement.setFetchSize(int)`

  - ### getDefaultFetchSize

    public int getDefaultFetchSize()
    Description copied from interface: `PGConnection`
    Get the default fetch size for statements created from this connection.
    Specified by:
      `getDefaultFetchSize` in interface `PGConnection`
    Returns:
      current state for default fetch size
    See Also:
      - `PGProperty.DEFAULT_ROW_FETCH_SIZE`
      - `Statement.getFetchSize()`

  - ### setPrepareThreshold

    public void setPrepareThreshold(int newThreshold)
    Description copied from interface: `PGConnection`
    Set the default statement reuse threshold before enabling server-side prepare. See `PGStatement.setPrepareThreshold(int)` for details.
    Specified by:
      `setPrepareThreshold` in interface `PGConnection`
    Parameters:
      `newThreshold` - the new threshold

  - ### getForceBinary

    public boolean getForceBinary()

  - ### setForceBinary

    public void setForceBinary(boolean newValue)

  - ### setTypeMapImpl

    public void setTypeMapImpl(Map<String,Class<?>> map) throws SQLException
    Throws:
      `SQLException`

  - ### getLogger

    public Logger getLogger()
    Specified by:
      `getLogger` in interface `BaseConnection`

  - ### getProtocolVersion

    public ProtocolVersion getProtocolVersion()

  - ### getStringVarcharFlag

    public boolean getStringVarcharFlag()
    Specified by:
      `getStringVarcharFlag` in interface `BaseConnection`

  - ### getCopyAPI

    public CopyManager getCopyAPI() throws SQLException
    Description copied from interface: `PGConnection`
    This returns the COPY API for the current connection.
    Specified by:
      `getCopyAPI` in interface `PGConnection`
    Returns:
      COPY API for the current connection
    Throws:
      `SQLException` - if something wrong happens

  - ### binaryTransferSend

    public boolean binaryTransferSend(int oid)
    Description copied from interface: `BaseConnection`
    Returns true if value for the given oid should be sent using binary transfer. False if value should be sent using text transfer.
    Specified by:
      `binaryTransferSend` in interface `BaseConnection`
    Parameters:
      `oid` - The oid to check.
    Returns:
      True for binary transfer, false for text transfer.

  - ### getBackendPID

    public int getBackendPID()
    Description copied from interface: `PGConnection`
    Return the process ID (PID) of the backend server process handling this connection.
    Specified by:
      `getBackendPID` in interface `PGConnection`
    Returns:
      PID of backend server process.

  - ### isColumnSanitiserDisabled

    public boolean isColumnSanitiserDisabled()
    Description copied from interface: `BaseConnection`
    Return whether to disable column name sanitation.
    Specified by:
      `isColumnSanitiserDisabled` in interface `BaseConnection`
    Returns:
      true column sanitizer is disabled

  - ### setDisableColumnSanitiser

    public void setDisableColumnSanitiser(boolean disableColumnSanitiser)

  - ### getPreferQueryMode

    public PreferQueryMode getPreferQueryMode()
    Description copied from interface: `PGConnection`
    Returns the query mode for this connection.

    When running in simple query mode, certain features are not available: callable statements, partial result set fetch, bytea type, etc.

    The list of supported features is subject to change.

    Specified by:
      `getPreferQueryMode` in interface `PGConnection`
    Returns:
      the preferred query mode
    See Also:
      - `PreferQueryMode`

  - ### getAutosave

    public AutoSave getAutosave()
    Description copied from interface: `PGConnection`
    Connection configuration regarding automatic per-query savepoints.
    Specified by:
      `getAutosave` in interface `PGConnection`
    Returns:
      connection configuration regarding automatic per-query savepoints
    See Also:
      - `PGProperty.AUTOSAVE`

  - ### setAutosave

    public void setAutosave(AutoSave autoSave)
    Description copied from interface: `PGConnection`
    Configures if connection should use automatic savepoints.
    Specified by:
      `setAutosave` in interface `PGConnection`
    Parameters:
      `autoSave` - connection configuration regarding automatic per-query savepoints
    See Also:
      - `PGProperty.AUTOSAVE`

  - ### abort

    protected void abort()

  - ### addTimerTask

    public void addTimerTask(TimerTask timerTask, long milliSeconds)
    Description copied from interface: `BaseConnection`
    Schedule a TimerTask for later execution. The task will be scheduled with the shared Timer for this connection.
    Specified by:
      `addTimerTask` in interface `BaseConnection`
    Parameters:
      `timerTask` - timer task to schedule
      `milliSeconds` - delay in milliseconds

  - ### purgeTimerTasks

    public void purgeTimerTasks()
    Description copied from interface: `BaseConnection`
    Invoke purge() on the underlying shared Timer so that internal resources will be released.
    Specified by:
      `purgeTimerTasks` in interface `BaseConnection`

  - ### escapeIdentifier

    public String escapeIdentifier(String identifier) throws SQLException
    Description copied from interface: `PGConnection`
    Return the given string suitably quoted to be used as an identifier in an SQL statement string. Quotes are added only if necessary (i.e., if the string contains non-identifier characters or would be case-folded). Embedded quotes are properly doubled.
    Specified by:
      `escapeIdentifier` in interface `PGConnection`
    Parameters:
      `identifier` - input identifier
    Returns:
      the escaped identifier
    Throws:
      `SQLException` - if something goes wrong

  - ### escapeLiteral

    public String escapeLiteral(String literal) throws SQLException
    Description copied from interface: `PGConnection`
    Return the given string suitably quoted to be used as a string literal in an SQL statement string. Embedded single-quotes and backslashes are properly doubled. Note that quote_literal returns null on null input.
    Specified by:
      `escapeLiteral` in interface `PGConnection`
    Parameters:
      `literal` - input literal
    Returns:
      the quoted literal
    Throws:
      `SQLException` - if something goes wrong

  - ### getFieldMetadataCache

    public LruCache<FieldMetadata.Key,FieldMetadata> getFieldMetadataCache()
    Description copied from interface: `BaseConnection`
    Return metadata cache for given connection.
    Specified by:
      `getFieldMetadataCache` in interface `BaseConnection`
    Returns:
      metadata cache

  - ### getReplicationAPI

    public PGReplicationConnection getReplicationAPI()
    Specified by:
      `getReplicationAPI` in interface `PGConnection`
    Returns:
      replication API for the current connection

  - ### createStatement

    public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
    Specified by:
      `createStatement` in interface `Connection`
    Throws:
      `SQLException`

  - ### prepareStatement

    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
    Specified by:
      `prepareStatement` in interface `Connection`
    Throws:
      `SQLException`

  - ### prepareCall

    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
    Specified by:
      `prepareCall` in interface `Connection`
    Throws:
      `SQLException`

  - ### getMetaData

    public DatabaseMetaData getMetaData() throws SQLException
    Specified by:
      `getMetaData` in interface `Connection`
    Throws:
      `SQLException`

  - ### setTypeMap

    public void setTypeMap(Map<String,Class<?>> map) throws SQLException
    Specified by:
      `setTypeMap` in interface `Connection`
    Throws:
      `SQLException`

  - ### makeArray

    protected Array makeArray(int oid, @Nullable String fieldString) throws SQLException
    Throws:
      `SQLException`

  - ### makeBlob

    protected Blob makeBlob(long oid) throws SQLException
    Throws:
      `SQLException`

  - ### makeClob

    protected Clob makeClob(long oid) throws SQLException
    Throws:
      `SQLException`

  - ### makeSQLXML

    protected SQLXML makeSQLXML() throws SQLException
    Throws:
      `SQLException`

  - ### createClob

    public Clob createClob() throws SQLException
    Specified by:
      `createClob` in interface `Connection`
    Throws:
      `SQLException`

  - ### createBlob

    public Blob createBlob() throws SQLException
    Specified by:
      `createBlob` in interface `Connection`
    Throws:
      `SQLException`

  - ### createNClob

    public NClob createNClob() throws SQLException
    Specified by:
      `createNClob` in interface `Connection`
    Throws:
      `SQLException`

  - ### createSQLXML

    public SQLXML createSQLXML() throws SQLException
    Specified by:
      `createSQLXML` in interface `Connection`
    Throws:
      `SQLException`

  - ### createStruct

    public Struct createStruct(String typeName, Object[] attributes) throws SQLException
    Specified by:
      `createStruct` in interface `Connection`
    Throws:
      `SQLException`

  - ### createArrayOf

    public Array createArrayOf(String typeName, @Nullable Object elements) throws SQLException
    Description copied from interface: `PGConnection`
    Creates an `Array` wrapping elements. This is similar to `Connection.createArrayOf(String, Object[])`, but also provides support for primitive arrays.
    Specified by:
      `createArrayOf` in interface `PGConnection`
    Parameters:
      `typeName` - The SQL name of the type to map the elements to. Must not be `null`.
      `elements` - The array of objects to map. A `null` value will result in an `Array` representing `null`.
    Returns:
      An `Array` wrapping elements.
    Throws:
      `SQLException` - If for some reason the array cannot be created.
    See Also:
      - `Connection.createArrayOf(String, Object[])`

  - ### createArrayOf

    public Array createArrayOf(String typeName, @Nullable Object @Nullable [] elements) throws SQLException
    Specified by:
      `createArrayOf` in interface `Connection`
    Throws:
      `SQLException`

  - ### isValid

    public boolean isValid(int timeout) throws SQLException
    Specified by:
      `isValid` in interface `Connection`
    Throws:
      `SQLException`

  - ### setClientInfo

    public void setClientInfo(String name, @Nullable String value) throws SQLClientInfoException
    Specified by:
      `setClientInfo` in interface `Connection`
    Throws:
      `SQLClientInfoException`

  - ### setClientInfo

    public void setClientInfo(Properties properties) throws SQLClientInfoException
    Specified by:
      `setClientInfo` in interface `Connection`
    Throws:
      `SQLClientInfoException`

  - ### getClientInfo

    public @Nullable String getClientInfo(String name) throws SQLException
    Specified by:
      `getClientInfo` in interface `Connection`
    Throws:
      `SQLException`

  - ### getClientInfo

    public Properties getClientInfo() throws SQLException
    Specified by:
      `getClientInfo` in interface `Connection`
    Throws:
      `SQLException`

  - ### createQueryObject

    public <T> T createQueryObject(Class<T> ifc) throws SQLException
    Throws:
      `SQLException`

  - ### getLogServerErrorDetail

    public boolean getLogServerErrorDetail()
    Description copied from interface: `BaseConnection`
    Indicates if error details from server used in included in logging and exceptions.
    Specified by:
      `getLogServerErrorDetail` in interface `BaseConnection`
    Returns:
      true if should be included and passed on to other exceptions

  - ### getConvertBooleanToNumeric

    public boolean getConvertBooleanToNumeric()
    Description copied from interface: `BaseConnection`
    Returns true if boolean values should be converted to numeric types (1/0).
    Specified by:
      `getConvertBooleanToNumeric` in interface `BaseConnection`
    Returns:
      true if boolean to numeric conversion is enabled

  - ### isWrapperFor

    public boolean isWrapperFor(Class<?> iface) throws SQLException
    Specified by:
      `isWrapperFor` in interface `Wrapper`
    Throws:
      `SQLException`

  - ### unwrap

    public <T> T unwrap(Class<T> iface) throws SQLException
    Specified by:
      `unwrap` in interface `Wrapper`
    Throws:
      `SQLException`

  - ### getSchema

    public @Nullable String getSchema() throws SQLException
    Specified by:
      `getSchema` in interface `Connection`
    Throws:
      `SQLException`

  - ### setSchema

    public void setSchema(@Nullable String schema) throws SQLException
    Specified by:
      `setSchema` in interface `Connection`
    Throws:
      `SQLException`

  - ### abort

    public void abort(Executor executor) throws SQLException
    Specified by:
      `abort` in interface `Connection`
    Throws:
      `SQLException`

  - ### setNetworkTimeout

    public void setNetworkTimeout(@Nullable Executor executor, int milliseconds) throws SQLException
    Specified by:
      `setNetworkTimeout` in interface `Connection`
    Throws:
      `SQLException`

  - ### getNetworkTimeout

    public int getNetworkTimeout() throws SQLException
    Specified by:
      `getNetworkTimeout` in interface `Connection`
    Throws:
      `SQLException`

  - ### setHoldability

    public void setHoldability(int holdability) throws SQLException
    Specified by:
      `setHoldability` in interface `Connection`
    Throws:
      `SQLException`

  - ### getHoldability

    public int getHoldability() throws SQLException
    Specified by:
      `getHoldability` in interface `Connection`
    Throws:
      `SQLException`

  - ### setSavepoint

    public Savepoint setSavepoint() throws SQLException
    Specified by:
      `setSavepoint` in interface `Connection`
    Throws:
      `SQLException`

  - ### setSavepoint

    public Savepoint setSavepoint(String name) throws SQLException
    Specified by:
      `setSavepoint` in interface `Connection`
    Throws:
      `SQLException`

  - ### rollback

    public void rollback(Savepoint savepoint) throws SQLException
    Specified by:
      `rollback` in interface `Connection`
    Throws:
      `SQLException`

  - ### releaseSavepoint

    public void releaseSavepoint(Savepoint savepoint) throws SQLException
    Specified by:
      `releaseSavepoint` in interface `Connection`
    Throws:
      `SQLException`

  - ### createStatement

    public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
    Specified by:
      `createStatement` in interface `Connection`
    Throws:
      `SQLException`

  - ### prepareStatement

    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
    Specified by:
      `prepareStatement` in interface `Connection`
    Throws:
      `SQLException`

  - ### prepareCall

    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
    Specified by:
      `prepareCall` in interface `Connection`
    Throws:
      `SQLException`

  - ### prepareStatement

    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
    Specified by:
      `prepareStatement` in interface `Connection`
    Throws:
      `SQLException`

  - ### prepareStatement

    public PreparedStatement prepareStatement(String sql, int @Nullable [] columnIndexes) throws SQLException
    Specified by:
      `prepareStatement` in interface `Connection`
    Throws:
      `SQLException`

  - ### prepareStatement

    public PreparedStatement prepareStatement(String sql, String @Nullable [] columnNames) throws SQLException
    Specified by:
      `prepareStatement` in interface `Connection`
    Throws:
      `SQLException`

  - ### getParameterStatuses

    public final Map<String,String> getParameterStatuses()
    Description copied from interface: `PGConnection`
    Returns the current values of all parameters reported by the server.

    PostgreSQL reports values for a subset of parameters (GUCs) to the client at connect-time, then sends update messages whenever the values change during a session. PgJDBC records the latest values and exposes it to client applications via `getParameterStatuses()`.

    PgJDBC exposes individual accessors for some of these parameters as listed below. They are more backwards-compatible and should be preferred where possible.

    Not all parameters are reported, only those marked `GUC_REPORT` in the source code. The `pg_settings` view does not expose information about which parameters are reportable. PgJDBC's map will only contain the parameters the server reports values for, so you cannot use this method as a substitute for running a `SHOW paramname;` or `SELECT current_setting('paramname');` query for arbitrary parameters.

    Parameter names are case-insensitive and case-preserving in this map, like in PostgreSQL itself. So `DateStyle` and `datestyle` are the same key.

    As of PostgreSQL 11 the reportable parameter list, and related PgJDBC interfaces or assessors, are:

    - `application_name` - `Connection.getClientInfo()`, `Connection.setClientInfo(java.util.Properties)` and `ApplicationName` connection property.
    - `client_encoding` - PgJDBC always sets this to `UTF8`. See `allowEncodingChanges` connection property.
    - `DateStyle` - PgJDBC requires this to always be set to `ISO`
    - `standard_conforming_strings` - indirectly via `PGConnection.escapeLiteral(String)`
    - `TimeZone` - set from JDK timezone see `TimeZone.getDefault()` and `TimeZone.setDefault(TimeZone)`
    - `integer_datetimes`
    - `IntervalStyle`
    - `server_encoding`
    - `server_version`
    - `is_superuser`
    - `session_authorization`

    Note that some PgJDBC operations will change server parameters automatically.

    Specified by:
      `getParameterStatuses` in interface `PGConnection`
    Returns:
      unmodifiable map of case-insensitive parameter names to parameter values

  - ### getParameterStatus

    public final @Nullable String getParameterStatus(String parameterName)
    Description copied from interface: `PGConnection`
    Shorthand for getParameterStatuses().get(...) .
    Specified by:
      `getParameterStatus` in interface `PGConnection`
    Parameters:
      `parameterName` - case-insensitive parameter name
    Returns:
      parameter value if defined, or null if no parameter known
    See Also:
      - `PGConnection.getParameterStatuses()`

  - ### getAdaptiveFetch

    public boolean getAdaptiveFetch()
    Description copied from interface: `PGConnection`
    Get state of adaptive fetch for connection.
    Specified by:
      `getAdaptiveFetch` in interface `PGConnection`
    Returns:
      state of adaptive fetch (turned on or off)

  - ### setAdaptiveFetch

    public void setAdaptiveFetch(boolean adaptiveFetch)
    Description copied from interface: `PGConnection`
    Turn on/off adaptive fetch for connection. Existing statements and resultSets won't be affected by change here.
    Specified by:
      `setAdaptiveFetch` in interface `PGConnection`
    Parameters:
      `adaptiveFetch` - desired state of adaptive fetch.

  - ### getXmlFactoryFactory

    public PGXmlFactoryFactory getXmlFactoryFactory() throws SQLException
    Description copied from interface: `BaseConnection`
    Retrieve the factory to instantiate XML processing factories.
    Specified by:
      `getXmlFactoryFactory` in interface `BaseConnection`
    Returns:
      The factory to use to instantiate XML processing factories
    Throws:
      `SQLException` - if the class cannot be found or instantiated.