Skip to content

Commit

Permalink
fixing review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dutow committed Feb 4, 2025
1 parent 5cc49b1 commit 04e0708
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions contrib/pg_tde/expected/change_access_method.out
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ CREATE TABLE country_table3 (
country_name text unique not null,
continent text not null
) USING heap;
psql:sql/change_access_method.inc:54: ERROR: pg_tde.enforce_encryption is ON, only encrypted tables can be created.
psql:sql/change_access_method.inc:54: ERROR: pg_tde.enforce_encryption is ON, only the tde_heap access method is allowed.

ALTER TABLE country_table SET access method heap;
psql:sql/change_access_method.inc:56: ERROR: pg_tde.enforce_encryption is ON, only encrypted tables can be created.
psql:sql/change_access_method.inc:56: ERROR: pg_tde.enforce_encryption is ON, only the tde_heap access method is allowed.
ALTER TABLE country_table2 SET access method :tde_am;
CREATE TABLE country_table3 (
country_id serial primary key,
Expand Down
8 changes: 4 additions & 4 deletions contrib/pg_tde/expected/change_access_method_basic.out
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,18 @@ CREATE TABLE country_table3 (
country_name text unique not null,
continent text not null
) USING heap;
psql:sql/change_access_method.inc:54: ERROR: pg_tde.enforce_encryption is ON, only encrypted tables can be created.
psql:sql/change_access_method.inc:54: ERROR: pg_tde.enforce_encryption is ON, only the tde_heap access method is allowed.

ALTER TABLE country_table SET access method heap;
psql:sql/change_access_method.inc:56: ERROR: pg_tde.enforce_encryption is ON, only encrypted tables can be created.
psql:sql/change_access_method.inc:56: ERROR: pg_tde.enforce_encryption is ON, only the tde_heap access method is allowed.
ALTER TABLE country_table2 SET access method :tde_am;
psql:sql/change_access_method.inc:58: ERROR: pg_tde.enforce_encryption is ON, only encrypted tables can be created.
psql:sql/change_access_method.inc:58: ERROR: pg_tde.enforce_encryption is ON, only the tde_heap access method is allowed.
CREATE TABLE country_table3 (
country_id serial primary key,
country_name text unique not null,
continent text not null
) using :tde_am;
psql:sql/change_access_method.inc:64: ERROR: pg_tde.enforce_encryption is ON, only encrypted tables can be created.
psql:sql/change_access_method.inc:64: ERROR: pg_tde.enforce_encryption is ON, only the tde_heap access method is allowed.
DROP TABLE country_table;
DROP TABLE country_table2;
DROP TABLE country_table3;
Expand Down
12 changes: 1 addition & 11 deletions contrib/pg_tde/src/pg_tde_event_capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ checkEncryptionClause(const char *accessMethod)
if (EnforceEncryption && !tdeCurrentCreateEvent.encryptMode)
{
ereport(ERROR,
(errmsg("pg_tde.enforce_encryption is ON, only encrypted tables can be created.")));
(errmsg("pg_tde.enforce_encryption is ON, only the tde_heap access method is allowed.")));
}
}

Expand Down Expand Up @@ -156,8 +156,6 @@ pg_tde_ddl_command_start_capture(PG_FUNCTION_ARGS)
AlterTableStmt *stmt = (AlterTableStmt *) parsetree;
ListCell *lcmd;

bool isAccessMethodChange = false;

foreach(lcmd, stmt->cmds)
{
AlterTableCmd *cmd = (AlterTableCmd *) lfirst(lcmd);
Expand All @@ -166,19 +164,11 @@ pg_tde_ddl_command_start_capture(PG_FUNCTION_ARGS)
{
const char *accessMethod = cmd->name;

isAccessMethodChange = true;

tdeCurrentCreateEvent.eventType = TDE_TABLE_CREATE_EVENT;
tdeCurrentCreateEvent.relation = stmt->relation;
checkEncryptionClause(accessMethod);
}
}

if (EnforceEncryption && isAccessMethodChange && !tdeCurrentCreateEvent.encryptMode)
{
ereport(ERROR,
(errmsg("pg_tde.enforce_encryption is ON, only encrypted table access methods are allowed.")));
}
}
#endif
PG_RETURN_NULL();
Expand Down
12 changes: 11 additions & 1 deletion contrib/pg_tde/src/pg_tde_guc.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@

/*-------------------------------------------------------------------------
*
* pg_tde_guc.c
* GUC variables for pg_tde
*
*
* IDENTIFICATION
* src/pg_tde_guc.c
*
*-------------------------------------------------------------------------
*/

#include "pg_tde_guc.h"
#include "postgres.h"
Expand Down

0 comments on commit 04e0708

Please sign in to comment.