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

Update Postgresql merge related tests #24429

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
case SUPPORTS_CANCELLATION,
SUPPORTS_JOIN_PUSHDOWN,
SUPPORTS_JOIN_PUSHDOWN_WITH_VARCHAR_EQUALITY,
SUPPORTS_TOPN_PUSHDOWN,
SUPPORTS_TOPN_PUSHDOWN_WITH_VARCHAR,
SUPPORTS_MERGE,
SUPPORTS_ROW_LEVEL_UPDATE,
SUPPORTS_MERGE -> true;
SUPPORTS_TOPN_PUSHDOWN,
SUPPORTS_TOPN_PUSHDOWN_WITH_VARCHAR -> true;
case SUPPORTS_ADD_COLUMN_WITH_COMMENT,
SUPPORTS_CREATE_TABLE_WITH_COLUMN_COMMENT,
SUPPORTS_JOIN_PUSHDOWN_WITH_FULL_JOIN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,12 @@ private void testJdbcMergeConnectionCreations()
{
assertJdbcConnections("CREATE TABLE copy_of_customer AS SELECT * FROM customer", 15, Optional.empty());

addPrimaryKeyToCopyTable();
postgreSqlServer.execute("ALTER TABLE copy_of_customer ADD CONSTRAINT t_copy_of_customer PRIMARY KEY (custkey)");
assertJdbcConnections("DELETE FROM copy_of_customer WHERE abs(custkey) = 1", 24, Optional.empty());
assertJdbcConnections("UPDATE copy_of_customer SET name = 'POLAND' WHERE abs(custkey) = 1", 32, Optional.empty());
assertJdbcConnections("MERGE INTO copy_of_customer c USING customer r ON r.custkey = c.custkey WHEN MATCHED THEN DELETE", 28, Optional.empty());
}

private void addPrimaryKeyToCopyTable()
{
postgreSqlServer.execute("ALTER TABLE copy_of_customer ADD CONSTRAINT t_copy_of_customer PRIMARY KEY (custkey)");
}

private static final class TestingPostgreSqlModule
extends AbstractConfigurationAwareModule
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,12 @@ private void testJdbcMergeConnectionCreations()
{
assertJdbcConnections("CREATE TABLE copy_of_customer AS SELECT * FROM customer", 6, Optional.empty());

addPrimaryKeyToCopyTable();
postgreSqlServer.execute("ALTER TABLE copy_of_customer ADD CONSTRAINT t_copy_of_nation PRIMARY KEY (custkey)");
assertJdbcConnections("DELETE FROM copy_of_customer WHERE abs(custkey) = 1", 17, Optional.empty());
assertJdbcConnections("UPDATE copy_of_customer SET name = 'POLAND' WHERE abs(custkey) = 1", 25, Optional.empty());
assertJdbcConnections("MERGE INTO copy_of_customer c USING customer r ON r.custkey = c.custkey WHEN MATCHED THEN DELETE", 18, Optional.empty());
}

private void addPrimaryKeyToCopyTable()
{
postgreSqlServer.execute("ALTER TABLE copy_of_customer ADD CONSTRAINT t_copy_of_nation PRIMARY KEY (custkey)");
}

private static final class TestingPostgreSqlModule
extends AbstractConfigurationAwareModule
{
Expand Down
Loading