Skip to content

[format] CAST() vs ::Β #212

@pyramation

Description

@pyramation
+CAST(ARRAY['function_schema', 'function_name'] AS text[])
-ARRAY['function_schema', 'function_name']::text[]

Output:

INSERT INTO migrations_public.definition (
  name,
  deploy,
  verify,
  revert,
  depl,
  args,
  deps
) VALUES
('current_user_agent', migrations_private.quoted_text((((((((((((((((((((((('' || '
CREATE FUNCTION %1$I.%2$I ()') || '
  RETURNS text') || '
AS $$') || '
DECLARE') || '
  v_uagent text;') || '
BEGIN') || '
  IF current_setting(''jwt.claims.user_agent'', TRUE)') || '
    IS NOT NULL THEN') || '
    BEGIN') || '
      v_uagent = current_setting(''jwt.claims.user_agent'', TRUE);') || '
    EXCEPTION') || '
      WHEN OTHERS THEN') || '
      RAISE NOTICE ''Invalid UserAgent'';') || '
    RETURN NULL;') || '
    END;') || '
    RETURN v_uagent;') || '
  ELSE') || '
    RETURN NULL;') || '
  END IF;') || '
END;') || '
$$') || '
LANGUAGE ''plpgsql'' STABLE;') || '
GRANT EXECUTE ON FUNCTION %1$I.%2$I TO authenticated;'), migrations_private.quoted_text(''), migrations_private.quoted_text((('' || '
') || '
DROP FUNCTION %1$I.%2$I;') || '
'), CAST(ARRAY['procedure', '%1$s', '%2$s'] AS text[]), CAST(ARRAY['function_schema', 'function_name'] AS text[]), CAST(ARRAY['schema/%1$s'] AS text[])) ON CONFLICT (name) DO UPDATE SET depl = excluded.depl, deps = excluded.deps, args = excluded.args, deploy = excluded.deploy, revert = excluded.revert, verify = excluded.verify;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions