Skip to content

SQL functions and settings

Hardcharger™ runs DuckDB 2.0, so the SQL is DuckDB’s: see DuckDB’s documentation for the language itself. This page lists what Hardcharger adds. The function and setting tables are generated from a running server (duckdb_functions(), DESCRIBE, hardcharger_settings()), and CI fails when they drift.

Scalar functions

FunctionReturnsDescription
HARDCHARGER_CURRENT_CLUSTER()VARCHARThe cluster_id the replicas share, or NULL when unset.
HARDCHARGER_CURRENT_INSTANCE()VARCHARThis server process's id (a UUID), new at every start.
HARDCHARGER_CURRENT_SESSION()VARCHARThis session's id, its Warp SQL session id (s_...), as KILL SESSION and instrumentation name it.
HARDCHARGER_INSTRUMENTATION_CATALOG()VARCHARThe catalog of the instrumentation tables (empty when off).
HARDCHARGER_INSTRUMENTATION_ENABLED()BOOLEANWhether instrumentation is on.
HARDCHARGER_INSTRUMENTATION_SCHEMA()VARCHARThe schema of the instrumentation tables (empty when off).
HARDCHARGER_ROLE()VARCHARThe session's role: admin, user or readonly (for store users under access control, their role in the server's sense).
HARDCHARGER_USER()VARCHARThe user this session signed in as.
HARDCHARGER_VERSION()VARCHARThe server's version, such as 2.0.0-rc.1 (as --version prints it).
hardcharger_cancel()BOOLEANStops what a session runs and keeps the session (its next statement runs as usual): its statement ends cancelled, result streams are cut off, uploads in flight are aborted. Returns whether there was anything to stop; a session can't cancel itself. KILL SESSION does the same, then ends the session.

Table functions

hardcharger_active_connections()

A row per open session: who (user, role, tenant, how they signed in), from where (address, User-Agent, TLS, client certificate), what it runs (state, the statement, redacted as the log redacts it, since when) and its open result streams, partitions, uploads and retained results. Needs no instrumentation. Users see only their own sessions.

ColumnType
session_idVARCHAR
instance_idVARCHAR
cluster_idVARCHAR
usernameVARCHAR
roleVARCHAR
tenantVARCHAR
auth_methodVARCHAR
client_addressVARCHAR
proxy_addressVARCHAR
client_infoVARCHAR
session_tagsMAP(VARCHAR, VARCHAR)
tlsBOOLEAN
tls_versionVARCHAR
certificate_identityVARCHAR
certificate_thumbprintVARCHAR
token_certificate_boundBOOLEAN
stateVARCHAR
transactionVARCHAR
statement_idVARCHAR
statementVARCHAR
statement_started_atTIMESTAMP WITH TIME ZONE
queued_sinceTIMESTAMP WITH TIME ZONE
session_started_atTIMESTAMP WITH TIME ZONE
last_activity_atTIMESTAMP WITH TIME ZONE
cancel_reasonVARCHAR
result_partitionsINTEGER
open_result_streamsINTEGER
open_ingest_partsINTEGER
retained_resultsINTEGER
retained_rowsBIGINT
is_currentBOOLEAN

hardcharger_effective_privileges()

Under access control, what a user may do, directly or through its roles (via). Without an argument, the current user; with a user name, that user, for the administrator (or a tenant admin, for its own tenant's users).

ColumnType
user_nameVARCHAR
privilegeVARCHAR
object_typeVARCHAR
catalog_nameVARCHAR
schema_nameVARCHAR
object_nameVARCHAR
column_nameVARCHAR
viaVARCHAR
with_grant_optionBOOLEAN

hardcharger_grants()

Under access control, the grants in the store: who (grantee, a role or user), what (privilege, object_type and the object; column_name for a column grant), by whom and with grant option. The administrator sees all of them; a store user only grants to itself and to the roles it holds. No rows without access control.

ColumnType
granteeVARCHAR
grantee_typeVARCHAR
privilegeVARCHAR
object_typeVARCHAR
catalog_nameVARCHAR
schema_nameVARCHAR
object_nameVARCHAR
column_nameVARCHAR
grantorVARCHAR
with_grant_optionBOOLEAN
tenantVARCHAR

hardcharger_metrics()

The runtime metrics /metrics serves, one row per sample. Needs --enable-metrics.

ColumnType
nameVARCHAR
valueDOUBLE
labelsMAP(VARCHAR, VARCHAR)

hardcharger_policies()

Under access control, the row policies and column masks on tables the caller can see, and whether each applies to the current user.

ColumnType
nameVARCHAR
kindVARCHAR
catalog_nameVARCHAR
schema_nameVARCHAR
table_nameVARCHAR
column_nameVARCHAR
permissiveBOOLEAN
rolesVARCHAR[]
exempt_rolesVARCHAR[]
expressionVARCHAR
applies_to_current_userBOOLEAN

hardcharger_role_members()

Under access control, who holds which role (a user or another role), with admin option and grantor. A store user sees only its own memberships.

ColumnType
roleVARCHAR
memberVARCHAR
member_typeVARCHAR
admin_optionBOOLEAN
grantorVARCHAR
issuerVARCHAR
tenantVARCHAR

hardcharger_roles()

Under access control, the roles (PUBLIC among them). A store user sees only the roles it holds.

ColumnType
nameVARCHAR
builtinBOOLEAN
tenantVARCHAR
is_activeBOOLEAN

hardcharger_server_info()

One row: the versions, the instance and cluster ids, the start time and the uptime; for an administrator without catalog_access rules also the host, listen addresses and ports, TLS, the web UI, the access-control store and the session count (NULL for everyone else).

ColumnType
hardcharger_versionVARCHAR
duckdb_versionVARCHAR
arrow_versionVARCHAR
instance_idVARCHAR
cluster_idVARCHAR
instance_tagVARCHAR
start_timeTIMESTAMP WITH TIME ZONE
uptimeINTERVAL
uptime_secondsBIGINT
hostnameVARCHAR
os_platformVARCHAR
os_nameVARCHAR
os_versionVARCHAR
cpu_archVARCHAR
cpu_modelVARCHAR
cpu_countINTEGER
memory_total_bytesBIGINT
memory_resident_bytesBIGINT
database_pathVARCHAR
read_onlyBOOLEAN
listen_addressVARCHAR
portINTEGER
health_portINTEGER
metrics_addressVARCHAR
metrics_portINTEGER
oauth_enabledBOOLEAN
tls_enabledBOOLEAN
mtls_enabledBOOLEAN
mtls_client_certificate_requiredBOOLEAN
server_certificate_sha256VARCHAR
web_ui_enabledBOOLEAN
rbac_store_typeVARCHAR
session_countINTEGER
default_catalogVARCHAR
default_schemaVARCHAR
instrumentation_queuedBIGINT
instrumentation_droppedBIGINT
instrumentation_failedBIGINT

hardcharger_sessions()

The open sessions. Administrators see all of them; other users only their own.

ColumnType
session_idVARCHAR
usernameVARCHAR
roleVARCHAR
auth_methodVARCHAR
start_timeTIMESTAMP WITH TIME ZONE
runningBOOLEAN
is_currentBOOLEAN

hardcharger_settings()

Every hardcharger.* setting with its current, session and global value, scope, flag, environment variable, default and description.

ColumnType
nameVARCHAR
valueVARCHAR
session_valueVARCHAR
global_valueVARCHAR
scopeVARCHAR
settableBOOLEAN
cli_flagVARCHAR
input_typeVARCHAR
default_valueVARCHAR
env_varVARCHAR
descriptionVARCHAR

hardcharger_users()

Under access control, the store users: enabled, whether they have a password, tenant and attributes. A store user sees only itself.

ColumnType
nameVARCHAR
enabledBOOLEAN
has_passwordBOOLEAN
tenantVARCHAR
attributesMAP(VARCHAR, VARCHAR)
is_currentBOOLEAN

SET [SESSION | GLOBAL] hardcharger.<name> = <value> (or TO) and RESET [SESSION | GLOBAL] hardcharger.<name>. SET GLOBAL needs an administrator; startup settings can only be read, and say which option sets them.

SET hardcharger.query_timeout = 60;
SELECT name, value, scope FROM hardcharger_settings() WHERE name = 'hardcharger.query_timeout';
RESET hardcharger.query_timeout;

SET SESSION only

SettingTypeDefaultDescription
hardcharger.bypass_queueBOOLEANfalseSkip the statement queue for this session (admins only may turn it on).
hardcharger.query_tagVARCHARJSON object tagging this session's statements in instrumentation.
hardcharger.session_tagVARCHARJSON object tagging this session in instrumentation.

SET SESSION, or SET GLOBAL (administrators)

SettingTypeDefaultDescription
hardcharger.capture_query_profileVARCHARoffRecord DuckDB's query profile with each execution in instrumentation (off, standard, detailed). Startup option: --capture-query-profile.
hardcharger.max_queue_waitINTEGER300Seconds a statement may wait in the queue (0: forever). Startup option: --max-queue-wait.
hardcharger.query_log_levelVARCHARINFOLevel of statement log lines (DEBUG, INFO, WARNING, ERROR). Startup option: --query-log-level.
hardcharger.query_timeoutINTEGER0Statement timeout in seconds (0: none). A request's Warp-Statement-Timeout wins. Startup option: --query-timeout-seconds.

SET GLOBAL only (administrators)

SettingTypeDefaultDescription
hardcharger.graceful_shutdownBOOLEANtrueOn the first stop signal, let running statements finish (false: stop at once). Takes effect at the next signal. Startup option: --graceful-shutdown.
hardcharger.max_concurrent_statementsINTEGER0Statements that run at once; more wait in the queue (0: no queue). Startup option: --max-concurrent-statements.
hardcharger.max_queued_statementsINTEGER-1Statements that may wait for a slot (-1: 8 x max_concurrent_statements; 0: unbounded). Startup option: --max-queued-statements.
hardcharger.shutdown_grace_period_secondsINTEGER300How long a graceful shutdown waits for running statements (0: forever); also during a shutdown. Startup option: --shutdown-grace-period-seconds.

Read-only: set at startup

SettingTypeDefaultDescription
hardcharger.admin_bypass_queue_defaultBOOLEANtrueAdmin sessions skip the statement queue by default. Startup option: --admin-bypass-queue-default.
hardcharger.allow_unsigned_extensionsBOOLEANfalseDuckDB may load unsigned extensions. Startup option: --allow-unsigned-extensions.
hardcharger.auth_log_levelVARCHARINFOLevel of sign-in log lines. Startup option: --auth-log-level.
hardcharger.cluster_idVARCHARUUID shared by the replicas of one cluster (empty when unset). Startup option: --cluster-id.
hardcharger.enable_catalog_loggingBOOLEANfalseLog lines are also written to a logs table. Startup option: --enable-catalog-logging.
hardcharger.enable_instrumentationBOOLEANfalseSessions, statements and executions are recorded. Startup option: --enable-instrumentation.
hardcharger.enable_metricsBOOLEANfalseRuntime metrics are collected and served (/metrics, hardcharger_metrics()). Startup option: --enable-metrics.
hardcharger.health_check_interval_secondsINTEGER5Seconds between background health checks. Startup option: --health-check-interval-seconds.
hardcharger.health_check_staleness_secondsINTEGER15Age at which the last health check no longer counts. Startup option: --health-check-staleness-seconds.
hardcharger.instance_idVARCHARThis server process's UUID (as HARDCHARGER_CURRENT_INSTANCE()).
hardcharger.instance_tagVARCHARJSON object recorded with this instance. Startup option: --instance-tag.
hardcharger.instrumentation_catalogVARCHARCatalog of the instrumentation tables (empty when instrumentation is off). Startup option: --instrumentation-catalog.
hardcharger.instrumentation_schemaVARCHARSchema of the instrumentation tables (empty when instrumentation is off). Startup option: --instrumentation-schema.
hardcharger.log_catalogVARCHARCatalog of the logs table (empty when catalog logging is off). Startup option: --log-catalog.
hardcharger.log_schemaVARCHARSchema of the logs table (empty when catalog logging is off). Startup option: --log-schema.
hardcharger.max_header_bytesINTEGER16384Largest request header block accepted, in bytes. Startup option: --max-header-bytes.
hardcharger.max_sessionsINTEGER0Most non-admin sessions at once; more get too_many_sessions (0: unlimited). Startup option: --max-sessions.
hardcharger.memory_limitVARCHARDuckDB memory_limit (empty: DuckDB's default). Startup option: --memory-limit.
hardcharger.read_onlyBOOLEANfalseDatabase opened read-only: every write is refused. Startup option: --read-only.
hardcharger.session_idle_timeoutINTEGER900Seconds an idle session lives (0: forever). Startup option: --session-idle-timeout.
hardcharger.session_log_levelVARCHARINFOLevel of session log lines. Startup option: --session-log-level.
hardcharger.storage_versionVARCHARDuckDB storage version for new databases (empty: DuckDB's default). Startup option: --storage-version.
hardcharger.versionVARCHARServer version (as HARDCHARGER_VERSION()).

DuckDB’s 128-bit integers travel as Arrow decimal128(38, 0) by default, which every Arrow client reads. That type holds at most 38 digits, so a value of 1038 or more (a HUGEINT can reach about 1.7 × 1038, a UHUGEINT twice that) can’t be sent in it. Such a statement fails with a conversion error that names the value, rather than sending a wrong number:

Terminal window
$ HARDCHARGER_PASSWORD='change-me' hardcharger --host localhost --tls=false --username hardcharger --csv \
--command "SELECT 170141183460469231731687303715884105727::HUGEINT AS big"
Error: Conversion Error: Hardcharger cannot send the HUGEINT value 170141183460469231731687303715884105727 as Arrow decimal128(38, 0), which holds at most 38 digits. CAST it to VARCHAR, or run SET SESSION arrow_lossless_conversion = true (DuckDB's 16-byte HUGEINT Arrow type, which holds every value)

Every value that fits is sent exactly as before. For the others, either CAST to VARCHAR:

Terminal window
$ HARDCHARGER_PASSWORD='change-me' hardcharger --host localhost --tls=false --username hardcharger --csv \
--command "SELECT CAST(170141183460469231731687303715884105727::HUGEINT AS VARCHAR) AS big"
big
170141183460469231731687303715884105727

or turn on arrow_lossless_conversion for the session, which sends DuckDB’s own 16-byte Arrow types (an arrow.opaque extension type over fixed_size_binary(16), little-endian) that hold every value, and decode them in the client. It also changes how UUID and JSON columns are sent.

from adbc_driver_hardcharger import dbapi as hardcharger
with hardcharger.connect(uri="hardcharger://localhost?tls=false", username="hardcharger", password="change-me") as conn:
with conn.cursor() as cur:
cur.execute(operation="SET SESSION arrow_lossless_conversion = true")
cur.execute(operation="SELECT 340282366920938463463374607431768211455::UHUGEINT AS biggest")
raw = cur.fetchone()[0]
print(int.from_bytes(raw, byteorder="little", signed=False))
340282366920938463463374607431768211455

The hardcharger CLI decodes them for you: with the option on, it prints exact integers in every output mode.

Terminal window
$ HARDCHARGER_PASSWORD='change-me' hardcharger --host localhost --tls=false --username hardcharger --csv --quiet \
--command "SET SESSION arrow_lossless_conversion = true; SELECT 340282366920938463463374607431768211455::UHUGEINT AS biggest"
OK
biggest
340282366920938463463374607431768211455

Write SET SESSION: a plain SET arrow_lossless_conversion is DuckDB’s global setting, which changes every session’s results and needs an administrator (MANAGE CONFIG under access control). Over plain HTTP, the Warp SQL session option duckdb_arrow_lossless_conversion does the same for one session. JSON bind parameters beyond the 64-bit range bind exactly as HUGEINT or UHUGEINT; wider ones are refused.

KILL SESSION '<session id>';

Ends another session at once (administrators only); its next request gets 401 session_ended with reason killed. hardcharger_sessions() lists the ids. See Statement control.

With access control on, these run like SQL, one per statement:

Statements Guide
CREATE/ALTER/DROP USER, CREATE/DROP ROLE, GRANT role TO, REVOKE role FROM Users, roles and grants
GRANT/REVOKE privileges ON table, view, SCHEMA, CATALOG; system privileges Users, roles and grants
SHOW GRANTS, ALTER TABLE/VIEW … OWNER TO, SET ROLE Users, roles and grants
CREATE/DROP ROW POLICY, SHOW ROW POLICIES Row policies
CREATE/DROP MASKING POLICY, ALTER TABLE … MODIFY COLUMN … SET/UNSET MASKING POLICY, SHOW MASKING POLICIES Masking
CREATE/DROP TENANT, ALTER CATALOG … SET TENANT, ALTER TENANT … SET DEFAULT CATALOG, SHOW TENANTS Tenants
CREATE/DROP GROUP MAPPING, SHOW GROUP MAPPINGS SSO
CREATE/DROP SCOPED TOKEN, SHOW SCOPED TOKENS Scoped tokens

Row policies may call session_attribute('key') (a user attribute set with ALTER USER … SET ATTRIBUTE) and is_role_active('role').

Catalog Contents
_hardcharger_system Read-only views the drivers use: hardcharger_index_info (JDBC getIndexInfo) and hardcharger_view_definition
_hardcharger_instr Instrumentation (with --enable-instrumentation; administrators only)
_hardcharger_logs Catalog logging (with --enable-catalog-logging; administrators only)

Nobody writes to, detaches or USEs these catalogs.