-
Notifications
You must be signed in to change notification settings - Fork 590
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
fix(pgcdc): fix uppercase-identifier of pgcdc #17754
Conversation
@@ -180,7 +180,8 @@ private void validateTableSchema() throws SQLException { | |||
// check primary key | |||
// reference: https://wiki.postgresql.org/wiki/Retrieve_primary_key_columns | |||
try (var stmt = jdbcConnection.prepareStatement(ValidatorUtils.getSql("postgres.pk"))) { | |||
stmt.setString(1, this.schemaName + "." + this.tableName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just quote the object name?
String.format("\"%s\".\"%s\"", this.schemaName, this.tableName)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be another choice. I noticed that other sql statements use schemaName and tableName, so I think we should keep them consistent. Do you prefer "\"%s\".\"%s\""
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change to the validate sql needs to join two more system tables, I think it can be avoided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slightly prefer to keep consistent with other places, unless the cost of join is high.
Strictly speaking the manual quoting above is wrong, but I do believe no one would challenge this in practice:
test=# create table "my_test""table" ("Foo" int); -- two quotes required
CREATE TABLE
test=# select relname, quote_ident(relname) from pg_class where relname ^@ 'my_te';
relname | quote_ident
---------------+------------------
my_test"table | "my_test""table"
(1 row)
(pgdoc)
Embedded quotes are properly doubled
I thought the name should only be quoted by |
I think so, IIRC. any concern? |
...onnector-service/src/main/java/com/risingwave/connector/source/common/PostgresValidator.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
All good. Never mind. |
port = '${PGPORT:5432}', | ||
username = '${PGUSER:$USER}', | ||
password = '${PGPASSWORD:}', | ||
database.name = '${PGDATABASE:postgres}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, we better to test whether uppercase in database.name
can work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested. It works. But I also found a weird bug #17754 (comment). After some attempts, it's sometimes not reproduciable: only several special tables can trigger this bug. I'm still not aware of the exact condition. To merge this PR, I temporarily delete the tests about database.name
. Will create an issue later to track and fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, we didn't get bug report from our users yet. Agree to create a issue to track it.
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
9425213 | Triggered | Generic Password | 0670570 | ci/scripts/e2e-source-test.sh | View secret |
9425213 | Triggered | Generic Password | 0670570 | ci/scripts/e2e-source-test.sh | View secret |
9425213 | Triggered | Generic Password | 0670570 | ci/scripts/e2e-source-test.sh | View secret |
9425213 | Triggered | Generic Password | 7cf41c9 | ci/scripts/e2e-source-test.sh | View secret |
9425213 | Triggered | Generic Password | 7cf41c9 | ci/scripts/e2e-source-test.sh | View secret |
9425213 | Triggered | Generic Password | 938f610 | ci/scripts/e2e-source-test.sh | View secret |
9425213 | Triggered | Generic Password | 938f610 | ci/scripts/e2e-source-test.sh | View secret |
9425213 | Triggered | Generic Password | 938f610 | ci/scripts/e2e-source-test.sh | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
cd1a646
to
d1c95b2
Compare
d1c95b2
to
0670570
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either approach lgtm
Accidentally find a bug: if there's a new db is created in the upstream pg after RW setup a cdc connector, RW will crash. Investigating. |
9d92915
to
7374402
Compare
7374402
to
8aa28b0
Compare
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
fix #17752
Change the sql from using
::regclass
to usingschemaName
andtableName
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.