/** * Application-owned routines for schema diff (excludes extension members). */ /** Routines in $1 schema that are not owned by a PostgreSQL extension. */ export declare const APPLICATION_ROUTINES_IN_SCHEMA_QUERY = "\n SELECT\n \n p.proname AS routine_name,\n n.nspname AS routine_schema,\n CASE p.prokind\n WHEN 'p' THEN 'PROCEDURE'\n ELSE 'FUNCTION'\n END AS routine_type,\n p.oid::text AS routine_oid,\n pg_get_function_identity_arguments(p.oid) AS identity_arguments,\n pg_get_function_result(p.oid) AS data_type\n\n FROM pg_proc p\n JOIN pg_namespace n ON n.oid = p.pronamespace\n WHERE n.nspname = $1\n AND p.prokind IN ('f', 'p')\n AND NOT EXISTS (\n SELECT 1\n FROM pg_depend d\n WHERE d.classid = 'pg_proc'::regclass\n AND d.objid = p.oid\n AND d.deptype = 'e'\n )\n ORDER BY n.nspname, p.proname, identity_arguments\n"; /** Routines in any of $1::text[] schemas (extension members excluded). */ export declare const APPLICATION_ROUTINES_IN_SCHEMAS_QUERY = "\n SELECT\n \n p.proname AS routine_name,\n n.nspname AS routine_schema,\n CASE p.prokind\n WHEN 'p' THEN 'PROCEDURE'\n ELSE 'FUNCTION'\n END AS routine_type,\n p.oid::text AS routine_oid,\n pg_get_function_identity_arguments(p.oid) AS identity_arguments,\n pg_get_function_result(p.oid) AS data_type\n\n FROM pg_proc p\n JOIN pg_namespace n ON n.oid = p.pronamespace\n WHERE n.nspname = ANY($1::text[])\n AND p.prokind IN ('f', 'p')\n AND NOT EXISTS (\n SELECT 1\n FROM pg_depend d\n WHERE d.classid = 'pg_proc'::regclass\n AND d.objid = p.oid\n AND d.deptype = 'e'\n )\n ORDER BY n.nspname, p.proname, identity_arguments\n"; export interface IRoutineIdentity { routine_name: string; routine_type: string; routine_schema?: string; routine_oid?: string; identity_arguments?: string | null; routine_definition?: string | null; } /** * Stable key for matching routines across shadow vs target catalogs. * When schemas differ (e.g. ddp_shadow → public), OIDs must not be used — the same * logical function has different OIDs in each schema. */ export declare function routineIdentityKey(routine: IRoutineIdentity, options?: { useCatalogOid?: boolean; }): string; /** * Merge routine rows from multiple schemas; first row per logical key wins (call with shadow before target). */ export declare function mergeRoutinesByLogicalKey(rows: T[], options?: { useCatalogOid?: boolean; }): T[]; export declare function formatRoutineDropStatement(targetSchema: string, routine: IRoutineIdentity): string; //# sourceMappingURL=routineSql.d.ts.map