Skip to content

Session functions

Connection identity, selected database, named locks and statement state.

Connection identity, selected database, named locks and statement state.

connection_id

SignaturePurposeSource definition
mysql.connection_id() → bigintReturn the PostgreSQL backend PID for this connection.SQL

current_user

SignaturePurposeSource definition
mysql."current_user"() → textEffective PostgreSQL role formatted as role@%.SQL · C

database

SignaturePurposeSource definition
mysql.database() → textReturn the MySQL database selected in this session.SQL · C

found_rows

SignaturePurposeSource definition
mysql.found_rows() → bigintRead the session’s found-row count.SQL · C

get_lock

SignaturePurposeSource definition
mysql.get_lock("any", "any") → bigintAcquire a named session lock with a timeout.SQL · C

is_free_lock

SignaturePurposeSource definition
mysql.is_free_lock("any") → bigintCheck whether a named lock is available.SQL · C

is_used_lock

SignaturePurposeSource definition
mysql.is_used_lock("any") → bigintLook up the holder of a named lock.SQL · C

last_insert_id

SignaturePurposeSource definition
mysql.last_insert_id() → bigintRead the session’s last generated insert ID.SQL · C

release_all_locks

SignaturePurposeSource definition
mysql.release_all_locks() → bigintRelease all named locks held by this session.SQL · C

release_lock

SignaturePurposeSource definition
mysql.release_lock("any") → bigintRelease a named session lock.SQL · C

row_count

SignaturePurposeSource definition
mysql.row_count() → bigintRead the affected-row count for the previous statement.SQL · C

schema

SignaturePurposeSource definition
mysql.schema() → textReturn the MySQL database selected in this session.SQL · C

session_user

SignaturePurposeSource definition
mysql."session_user"() → textSession role and client host.SQL · C

sleep

SignaturePurposeSource definition
mysql.sleep(seconds numeric) → character varyingWait for the requested number of seconds.SQL

user

SignaturePurposeSource definition
mysql."user"() → textReturn PostgreSQL current_user as text.SQL

uuid

SignaturePurposeSource definition
mysql.uuid() → textGenerate a UUID.SQL

uuid_short

SignaturePurposeSource definition
mysql.uuid_short() → textGenerate a short MySQL-style identifier.SQL · C

version

SignaturePurposeSource definition
mysql.version() → textReturn the advertised MySQL server version.SQL · C