pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

Create script does not contain policy comment

Open chreck opened this issue 10 months ago • 0 comments

Describe the bug

In the object explorer we select a table and by right click on that table we choose Scripts > CREATE Script. In the detailed view we see the query to create the table and all its details. I.e. also the comments on the columns and the table. But I missing the comments for the defined policies.

To Reproduce

Steps to reproduce the behavior:

  1. Open Query Tool
  2. Copy this SQLs and execute it
CREATE TABLE IF NOT EXISTS public.table_comments_policies
(
	id bigint NOT NULL
)

CREATE POLICY plcy_table_comments_policies
    ON public.table_comments_policies
    AS PERMISSIVE
    FOR ALL
    TO authenticated
    USING (true)
    WITH CHECK (true);

COMMENT ON POLICY "plcy_table_comments_policies" ON "public"."table_comments_policies" IS 'All: auths';
  1. Refresh tables
  2. Right click on table table_comments_policies
  3. Choose Scripts > CREATE Script

Expected behavior

The expected behavior is that SQLs from the create scripts command contains the COMMENT ON POLICY command, but it is not included.

-- Table: public.table_comments_policies

-- DROP TABLE IF EXISTS public.table_comments_policies;

CREATE TABLE IF NOT EXISTS public.table_comments_policies
(
    id bigint NOT NULL
)

TABLESPACE pg_default;

ALTER TABLE IF EXISTS public.table_comments_policies
    OWNER to postgres;

GRANT ALL ON TABLE public.table_comments_policies TO anon;

GRANT ALL ON TABLE public.table_comments_policies TO authenticated;

GRANT ALL ON TABLE public.table_comments_policies TO postgres;

GRANT ALL ON TABLE public.table_comments_policies TO service_role;
-- POLICY: plcy_table_comments_policies

-- DROP POLICY IF EXISTS plcy_table_comments_policies ON public.table_comments_policies;

CREATE POLICY plcy_table_comments_policies
    ON public.table_comments_policies
    AS PERMISSIVE
    FOR ALL
    TO authenticated
    USING (true)
    WITH CHECK (true);

Error message

No error message.

Screenshots

No screenshots attached.

Desktop:

Additional context

  • Considering to add the comment also after choosing CREATE Script by right clicking on the policy item in Object Explorer itself
  • Considering to add the comment also in the Properties view by right clicking on the policy item in Object Explorer itself

chreck avatar Apr 22 '24 09:04 chreck