Class SessionState (0.15.0)

publicclass SessionState

SessionState contains all session variables for a connection.

Inheritance

java.lang.Object > SessionState

Constructors

SessionState(OptionsMetadata options)

publicSessionState(OptionsMetadataoptions)
Parameter
Name Description
options OptionsMetadata

Methods

commit()

publicvoidcommit()

Commits the current transaction and persists any changes to the settings (except local changes).

generatePGSettingsCte()

publicStringgeneratePGSettingsCte()

Generates a Common Table Expression that represents the pg_settings table. Note that the generated query adds two additional CTEs that could in theory hide existing user tables. It is however strongly recommended that user tables never start with 'pg_', as all system tables in PostgreSQL start with 'pg_' and 'pg_catalog' is by design always included in the search_path and is by default the first entry on the search_path. This means that user tables that start with 'pg_' always risk being hidden by user tables, unless pg_catalog has been explicitly added to the search_path after one or more user schemas.

Returns
Type Description

get(String extension, String name)

publicPGSettingget(Stringextension,Stringname)

Returns the current value of the specified setting.

Parameters
Name Description
extension String
name String
Returns
Type Description

getAll()

publicList<PGSetting>getAll()

Returns all settings and their current values.

Returns
Type Description

getDdlTransactionMode()

publicOptionsMetadata.DdlTransactionModegetDdlTransactionMode()

Returns the DdlTransactionMode that is used for this connection at this time.

Returns
Type Description

getTimezone()

publicZoneIdgetTimezone()

Returns the ZoneId of the current timezone for this session.

Returns
Type Description

isForceAutocommit()

publicbooleanisForceAutocommit()

Returns whether transaction statements should be ignored and all statements should be executed in autocommit mode.

Returns
Type Description

isReplacePgCatalogTables()

publicbooleanisReplacePgCatalogTables()

Returns the current setting for replacing pg_catalog tables with common table expressions.

Returns
Type Description

resetAll()

publicvoidresetAll()

Resets all values to their 'reset' value.

rollback()

publicvoidrollback()

Rolls back the current transaction and abandons any pending changes to the settings.

set(String extension, String name, String setting)

publicvoidset(Stringextension,Stringname,Stringsetting)

Sets the value of the specified setting. The new value will be persisted if the current transaction is committed. The value will be lost if the transaction is rolled back.

Parameters
Name Description
extension String
name String
setting String

setConnectionStartupValue(String extension, String name, String value)

publicvoidsetConnectionStartupValue(Stringextension,Stringname,Stringvalue)

Sets the value of the specified setting at connection startup.

Parameters
Name Description
extension String
name String
value String

setLocal(String extension, String name, String setting)

publicvoidsetLocal(Stringextension,Stringname,Stringsetting)

Sets the value of the specified setting for the current transaction. This value is lost when the transaction is committed or rolled back.

Parameters
Name Description
extension String
name String
setting String

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.