Skip to content

Commit

Permalink
[#20972] YSQL: Fix new local variable names in PG code
Browse files Browse the repository at this point in the history
Summary:
The diff applies post-commit comments from the diff:
5659b73
https://phorge.dev.yugabyte.com/D32252

2 YB specific local variables were renamed - to simplify any future Postgres code-base migrations.
Jira: DB-9947

Test Plan: Jenkins builds

Reviewers: mihnea, jason

Reviewed By: jason

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D36755
  • Loading branch information
OlegLoginov committed Jul 23, 2024
1 parent fe37ffd commit 7414711
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/postgres/src/bin/pg_dump/pg_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -15256,7 +15256,7 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId,
if (sql->len > 0)
{
PQExpBuffer tag = createPQExpBuffer();
PQExpBuffer use_roles_sql;
PQExpBuffer yb_use_roles_sql;

if (subname)
appendPQExpBuffer(tag, "COLUMN %s.%s", name, subname);
Expand All @@ -15265,20 +15265,20 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId,

if (dopt->include_yb_metadata)
{
use_roles_sql = createPQExpBuffer();
appendPQExpBuffer(use_roles_sql, "\\if :use_roles\n%s\\endif\n", sql->data);
yb_use_roles_sql = createPQExpBuffer();
appendPQExpBuffer(yb_use_roles_sql, "\\if :use_roles\n%s\\endif\n", sql->data);
}

ArchiveEntry(fout, nilCatalogId, createDumpId(),
tag->data, nspname,
NULL,
owner ? owner : "",
false, "ACL", SECTION_NONE,
dopt->include_yb_metadata ? use_roles_sql->data : sql->data,
dopt->include_yb_metadata ? yb_use_roles_sql->data : sql->data,
"", NULL, &(objDumpId), 1,
NULL, NULL);
if (dopt->include_yb_metadata)
destroyPQExpBuffer(use_roles_sql);
destroyPQExpBuffer(yb_use_roles_sql);

destroyPQExpBuffer(tag);
}
Expand Down
14 changes: 7 additions & 7 deletions src/postgres/src/bin/pg_dump/pg_dumpall.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ dumpRoles(PGconn *conn)
for (i = 0; i < PQntuples(res); i++)
{
const char *rolename;
char *frolename;
char *yb_frolename;
Oid auth_oid;

auth_oid = atooid(PQgetvalue(res, i, i_oid));
Expand All @@ -890,7 +890,7 @@ dumpRoles(PGconn *conn)
auth_oid);
}

frolename = pg_strdup(fmtId(rolename));
yb_frolename = pg_strdup(fmtId(rolename));
/*
* We dump CREATE ROLE followed by ALTER ROLE to ensure that the role
* will acquire the right properties even if it already exists (ie, it
Expand All @@ -911,15 +911,15 @@ dumpRoles(PGconn *conn)
"\\endif\n"
"\\if :role_exists\n"
" \\echo 'Role %s already exists.'\n"
"\\else\n ", frolename, frolename);
"\\else\n ", yb_frolename, yb_frolename);

appendPQExpBuffer(buf, "CREATE ROLE %s;\n", frolename);
appendPQExpBuffer(buf, "CREATE ROLE %s;\n", yb_frolename);

if (include_yb_metadata)
appendPQExpBufferStr(buf, "\\endif\n");
}

appendPQExpBuffer(buf, "ALTER ROLE %s WITH", frolename);
appendPQExpBuffer(buf, "ALTER ROLE %s WITH", yb_frolename);

if (strcmp(PQgetvalue(res, i, i_rolsuper), "t") == 0)
appendPQExpBufferStr(buf, " SUPERUSER");
Expand Down Expand Up @@ -975,7 +975,7 @@ dumpRoles(PGconn *conn)

if (!no_comments && !PQgetisnull(res, i, i_rolcomment))
{
appendPQExpBuffer(buf, "COMMENT ON ROLE %s IS ", frolename);
appendPQExpBuffer(buf, "COMMENT ON ROLE %s IS ", yb_frolename);
appendStringLiteralConn(buf, PQgetvalue(res, i, i_rolcomment), conn);
appendPQExpBufferStr(buf, ";\n");
}
Expand All @@ -989,7 +989,7 @@ dumpRoles(PGconn *conn)
appendPQExpBufferStr(buf, "\n");

fprintf(OPF, "%s", buf->data);
free(frolename);
free(yb_frolename);
}

/*
Expand Down

0 comments on commit 7414711

Please sign in to comment.