Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions pgpm/core/src/apply/materialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ export interface MaterializeApplyOptions {
outDir?: string;
}

// Functions that take a bare schema name as a string-literal first argument.
// The AST pass only remaps dotted literals ('schema.object'); these helpers
// (ubiquitous in verify scripts) name the schema alone, so a string-level
// pre-pass remaps them.
const SCHEMA_NAME_LITERAL_FUNCS = ['verify_schema', 'has_schema_privilege'];
// has_schema_privilege takes a bare schema name as a string literal. The AST
// pass only remaps dotted literals ('schema.object') and identity casts
// ('schema'::regnamespace), so this one is remapped by a string pre-pass.
const SCHEMA_NAME_LITERAL_FUNCS = ['has_schema_privilege'];

const schemaNameLiteralPass: SchemaTransformPass = (content, schemaMapping) => {
const pattern = new RegExp(
Expand Down
8 changes: 5 additions & 3 deletions pgpm/core/src/apply/reuse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ const FOLDER_KIND: Record<string, SchemaObjectRoute['kind']> = {
types: 'type'
};

// Mirrors materialize.ts: bare-schema-name literal helpers the AST pass can't
// reach are remapped by a narrow string pre-pass.
const SCHEMA_NAME_LITERAL_FUNCS = ['verify_schema', 'has_schema_privilege'];
// Mirrors materialize.ts.
// has_schema_privilege takes a bare schema name as a string literal. The AST
// pass only remaps dotted literals ('schema.object') and identity casts
// ('schema'::regnamespace), so this one is remapped by a string pre-pass.
const SCHEMA_NAME_LITERAL_FUNCS = ['has_schema_privilege'];
const schemaNameLiteralPass: SchemaTransformPass = (content, schemaMapping) => {
const pattern = new RegExp(
`\\b(${SCHEMA_NAME_LITERAL_FUNCS.join('|')})\\s*\\(\\s*'([^']+)'`,
Expand Down
Loading