MCPcopy Create free account
hub / github.com/PostHog/duckgres / buildSessionPgSequencesViewSQL

Function buildSessionPgSequencesViewSQL

server/sessionmeta/sessionmeta.go:613–636  ·  view source on GitHub ↗

buildSessionPgSequencesViewSQL builds the catalog-scoped pg_catalog.pg_sequences compat view (same cross-catalog-leak rationale as buildSessionPgTablesViewSQL). Sources duckdb_sequences() filtered to current_database(). Column names and types mirror DuckDB's native pg_sequences (the view these queri

()

Source from the content-addressed store, hash-verified

611 a.attcacheoff,
612 CASE
613 WHEN (dc.data_type LIKE 'DECIMAL%%' OR dc.data_type LIKE 'NUMERIC%%') AND a.atttypmod > 0 THEN
614 (((a.atttypmod / 1000)::INTEGER << 16) | ((a.atttypmod %% 1000)::INTEGER + 4))::INTEGER
615 ELSE a.atttypmod
616 END AS atttypmod,
617 a.attbyval,
618 a.attalign,
619 a.attstorage,
620 a.attcompression,
621 a.attnotnull,
622 a.atthasdef,
623 a.atthasmissing,
624 a.attidentity,
625 a.attgenerated,
626 a.attisdropped,
627 a.attislocal,
628 a.attinhcount::INTEGER AS attinhcount,
629 a.attcollation::UINTEGER AS attcollation,
630 a.attacl,
631 a.attoptions,
632 a.attfdwoptions,
633 a.attmissingval
634 FROM pg_catalog.pg_attribute a
635 JOIN main.pg_class_full c ON c.oid = a.attrelid
636 JOIN main.pg_namespace n ON n.oid = c.relnamespace
637 LEFT JOIN duckdb_columns() dc ON dc.table_oid = a.attrelid AND dc.column_name = a.attname
638 `, nativeTypeOID)
639}

Callers 1

buildSessionMetadataSQLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected