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

fixes to handling of custom publications for AddTablesToPublication #1289

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

heavycrystal
Copy link
Contributor

  1. need to fetch tables schema-qualified for comparison
  2. order of ArrayMinus was wrong
  3. also add validation for custom publication existing

serprex
serprex previously approved these changes Feb 14, 2024
@serprex
Copy link
Contributor

serprex commented Feb 14, 2024

Instead of schemaname||'.'||tablename you can have postgresql address identifier safety with %I: format('%I.%I', schemaname, tablename)

https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-QUOTE-LITERAL-EXAMPLE

Then get rid of schemaTable, err := utils.ParseSchemaTable(additionalSrcTable)

Alternative would be to select schemaname, tablename & then quote the identifiers together in code

@serprex serprex dismissed their stale review February 14, 2024 12:41

needs to fix quoting

@heavycrystal
Copy link
Contributor Author

Instead of schemaname||'.'||tablename you can have postgresql address identifier safety with %I: format('%I.%I', schemaname, tablename)

https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-QUOTE-LITERAL-EXAMPLE

Then get rid of schemaTable, err := utils.ParseSchemaTable(additionalSrcTable)

Alternative would be to select schemaname, tablename & then quote the identifiers together in code

We're getting additionalSourceTables completely unescaped from the UI, and we're comparing it with the unescaped identifiers being generated through simple string concat. Proper escaping is necessary, but it'll have to happen at both ends. Will handle this in the future.

@heavycrystal heavycrystal requested a review from serprex February 14, 2024 14:35
Copy link
Contributor

@iskakaushik iskakaushik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving to unblock a customer.

@iskakaushik iskakaushik merged commit db7cdfe into main Feb 14, 2024
7 checks passed
@iskakaushik iskakaushik deleted the add-table-custompub-fixes branch February 14, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants