8000 [Rebased] Errors handling during COPY FROM by ololobus · Pull Request #3 · ololobus/postgres · GitHub
[go: up one dir, main page]

Skip to content

[Rebased] Errors handling during COPY FROM #3

Open
ololobus wants to merge 8 commits intomasterfrom
copy-errors-rebased
Open

[Rebased] Errors handling during COPY FROM #3
ololobus wants to merge 8 commits intomasterfrom
copy-errors-rebased

Conversation

@ololobus
Copy link
Copy Markdown
Owner
@ololobus ololobus commented Jul 10, 2017

See #4

@speedynyc
Copy link
Copy Markdown

+1. I would like to see this implemented - Good job!

@l-we
Copy link
Copy Markdown
l-we commented Oct 20, 2017

please update postgres 10, thx

ololobus pushed a commit that referenced this pull request Oct 22, 2018
refresh_by_match_merge() has some issues in the way it builds a SQL
query to construct the "diff" table:

1. It doesn't require the selected unique index(es) to be indimmediate.
2. It doesn't pay attention to the particular equality semantics enforced
by a given index, but just assumes that they must be those of the column
datatype's default btree opclass.
3. It doesn't check that the indexes are btrees.
4. It's insufficiently careful to ensure that the parser will pick the
intended operator when parsing the query.  (This would have been a
security bug before CVE-2018-1058.)
5. It's not careful about indexes on system columns.

The way to fix #4 is to make use of the existing code in ri_triggers.c
for generating an arbitrary binary operator clause.  I chose to move
that to ruleutils.c, since that seems a more reasonable place to be
exporting such functionality from than ri_triggers.c.

While #1, #3, and #5 are just latent given existing feature restrictions,
and #2 doesn't arise in the core system for lack of alternate opclasses
with different equality behaviors, #4 seems like an issue worth
back-patching.  That's the bulk of the change anyway, so just back-patch
the whole thing to 9.4 where this code was introduced.

Discussion: https://postgr.es/m/13836.1521413227@sss.pgh.pa.us
ololobus pushed a commit that referenced this pull request Oct 22, 2018
refresh_by_match_merge() has some issues in the way it builds a SQL
query to construct the "diff" table:

1. It doesn't require the selected unique index(es) to be indimmediate.
2. It doesn't pay attention to the particular equality semantics enforced
by a given index, but just assumes that they must be those of the column
datatype's default btree opclass.
3. It doesn't check that the indexes are btrees.
4. It's insufficiently careful to ensure that the parser will pick the
intended operator when parsing the query.  (This would have been a
security bug before CVE-2018-1058.)
5. It's not careful about indexes on system columns.

The way to fix #4 is to make use of the existing code in ri_triggers.c
for generating an arbitrary binary operator clause.  I chose to move
that to ruleutils.c, since that seems a more reasonable place to be
exporting such functionality from than ri_triggers.c.

While #1, #3, and #5 are just latent given existing feature restrictions,
and #2 doesn't arise in the core system for lack of alternate opclasses
with different equality behaviors, #4 seems like an issue worth
back-patching.  That's the bulk of the change anyway, so just back-patch
the whole thing to 9.4 where this code was introduced.

Discussion: https://postgr.es/m/13836.1521413227@sss.pgh.pa.us
@ololobus ololobus force-pushed the master branch 3 times, most recently from 5fcc467 to 5c4df12 Compare November 20, 2018 08:56
@ololobus ololobus force-pushed the master branch 2 times, most recently from d2d0925 to aebce07 Compare December 20, 2018 15:13
@ololobus ololobus force-pushed the master branch 7 times, most recently from bc21adf to a5f92ff Compare February 8, 2019 14:15
@ololobus ololobus force-pushed the master branch 3 times, most recently from 4d92c23 to 8ad991f Compare October 4, 2019 08:50
@ololobus ololobus force-pushed the master branch 2 times, most recently from 5a2ad68 to 898c322 Compare October 11, 2019 11:06
@ololobus ololobus force-pushed the master branch 2 times, most recently from 4c121b5 to 2f0b4de Compare December 3, 2019 09:13
@ololobus ololobus force-pushed the master branch 3 times, most recently from 4661e21 to 5127f79 Compare December 29, 2019 10:18
@ololobus ololobus force-pushed the master branch 2 times, most recently from 1f34dab to b768b06 Compare January 16, 2020 16:29
@ololobus ololobus force-pushed the master branch 4 times, most recently from 44b25c2 to 150a227 Compare March 3, 2020 09:46
@ololobus ololobus force-pushed the master branch 3 times, most recently from 8542a98 to 2603ea1 Compare March 26, 2020 16:22
@ololobus ololobus force-pushed the master branch 4 times, most recently from 7c657da to 0e5f4f7 Compare April 6, 2020 11:24
@ololobus ololobus force-pushed the master branch 2 times, most recently from 28db880 to 7f8e356 Compare April 8, 2020 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0