Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming tables fails on Postgres 14 #105

Open
bakkerthehacker opened this issue Sep 25, 2023 · 1 comment · May be fixed by #107
Open

Renaming tables fails on Postgres 14 #105

bakkerthehacker opened this issue Sep 25, 2023 · 1 comment · May be fixed by #107
Labels

Comments

@bakkerthehacker
Copy link

Previously in #91 a few of the configuration parameters were adjusted to work correctly with the more strict requirements in postgres 14. However, there are still incompatible parameters that prevent renaming tables when running pgMemento on postgres 14.

Example:

db=# CREATE TABLE "MarketplaceAccounts" (id UUID PRIMARY KEY DEFAULT gen_random_uuid());
CREATE TABLE

db=#  SELECT pgmemento.init(
        log_old_data := TRUE,
        log_new_data := TRUE,
        log_state := TRUE,
        trigger_create_table := TRUE
      );
                    init                     
---------------------------------------------
 pgMemento is initialized for public schema.
(1 row)

db=# ALTER TABLE "MarketplaceAccounts" RENAME TO "ChannelAccounts";
ERROR:  invalid configuration parameter name "pgmemento.public."ChannelAccounts""
DETAIL:  Custom parameter names must be two or more simple identifiers separated by dots.
CONTEXT:  SQL statement "SELECT set_config(
        'pgmemento.' || quote_ident(schemaname) || '.' ||
        pgmemento.fetch_ident(substr(ddl_text,11,length(ddl_text))),
        table_log_id::text,
        TRUE
      )"
PL/pgSQL function table_alter_pre_trigger() line 76 at PERFORM
@FxKu
Copy link
Member

FxKu commented Sep 25, 2023

Why does Postgres allow tables with capital letters 😄 Just makes your life miserable. Note, that #91 was about config parameters using only the txid and not starting with a letter. In your case, the problem is that the quotes are not omitted - the parameter name should be "pgmemento.public.ChannelAccounts". I will have a look.

@FxKu FxKu added the bug label Sep 25, 2023
@FxKu FxKu linked a pull request Sep 29, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants