Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

typo fix#1

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
strk wants to merge1 commit intopostgres:masterfromstrk:typo
Closed

typo fix#1

strk wants to merge1 commit intopostgres:masterfromstrk:typo

Conversation

strk
Copy link

not much to say, just a typo fix

@mhagander
Copy link
Member

This is just a mirror of PostgreSQL, and not the development repo. Please seehttp://wiki.postgresql.org/wiki/Submitting_a_Patch for how to submit a patch to PostgreSQL.

@strk
Copy link
Author

On Wed, Feb 22, 2012 at 05:28:14AM -0800, Magnus Hagander wrote:

This is just a mirror of PostgreSQL, and not the development repo. Please seehttp://wiki.postgresql.org/wiki/Submitting_a_Patch for how to submit a patch to PostgreSQL.

Got it, thanks. Sent there.

--strk;

postgres-mirror pushed a commit that referenced this pull requestNov 24, 2013
These functions must be careful that they return the intended value oferrno to their callers.  There were several scenarios where this mightnot happen:1. The recent SSL renegotiation patch added a hunk of code that wouldexecute after setting errno.  In the first place, it's doubtful that weshould consider renegotiation to be successfully completed after a failure,and in the second, there's no real guarantee that the called OpenSSLroutines wouldn't clobber errno.  Fix by not executing that hunk exceptduring success exit.2. errno was left in an unknown state in case of an unrecognized returncode from SSL_get_error().  While this is a "can't happen" case, it seemslike a good idea to be sure we know what would happen, so reset errno toECONNRESET in such cases.  (The corresponding code in libpq's fe-secure.calready did this.)3. There was an (undocumented) assumption that client_read_ended() wouldn'tchange errno.  While true in the current state of the code, this seems lessthan future-proof.  Add explicit saving/restoring of errno to make surethat changes in the called functions won't break things.I see no need to back-patch, since#1 is new code and the other two issuesare mostly hypothetical.Per discussion with Amit Kapila.
krk pushed a commit to krk/postgres that referenced this pull requestNov 26, 2013
These functions must be careful that they return the intended value oferrno to their callers.  There were several scenarios where this mightnot happen:1. The recent SSL renegotiation patch added a hunk of code that wouldexecute after setting errno.  In the first place, it's doubtful that weshould consider renegotiation to be successfully completed after a failure,and in the second, there's no real guarantee that the called OpenSSLroutines wouldn't clobber errno.  Fix by not executing that hunk exceptduring success exit.2. errno was left in an unknown state in case of an unrecognized returncode from SSL_get_error().  While this is a "can't happen" case, it seemslike a good idea to be sure we know what would happen, so reset errno toECONNRESET in such cases.  (The corresponding code in libpq's fe-secure.calready did this.)3. There was an (undocumented) assumption that client_read_ended() wouldn'tchange errno.  While true in the current state of the code, this seems lessthan future-proof.  Add explicit saving/restoring of errno to make surethat changes in the called functions won't break things.I see no need to back-patch, sincepostgres#1 is new code and the other two issuesare mostly hypothetical.Per discussion with Amit Kapila.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestOct 7, 2014
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestOct 24, 2014
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestOct 24, 2014
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestNov 10, 2014
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestDec 9, 2014
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestDec 12, 2014
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestDec 13, 2014
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestDec 14, 2014
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestDec 16, 2014
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestJan 1, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestJan 8, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestJan 8, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestJan 9, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestJan 10, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestJan 29, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestFeb 5, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestFeb 6, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestFeb 10, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestFeb 12, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestFeb 26, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestFeb 26, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestFeb 27, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestFeb 27, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
petergeoghegan pushed a commit to petergeoghegan/postgres that referenced this pull requestMar 4, 2015
Includes documentation for executor README.  A high-level handling ofapproachpostgres#2 to value locking also appears there, since in contrast withdesignpostgres#1, that is something that lives in the head of the executor.
PJMODOS referenced this pull request in 2ndQuadrant/postgresFeb 2, 2016
postgres-mirror pushed a commit that referenced this pull requestMar 19, 2018
refresh_by_match_merge() has some issues in the way it builds a SQLquery 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 enforcedby a given index, but just assumes that they must be those of the columndatatype'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 theintended operator when parsing the query.  (This would have been asecurity bug beforeCVE-2018-1058.)5. It's not careful about indexes on system columns.The way tofix#4 is to make use of the existing code in ri_triggers.cfor generating an arbitrary binary operator clause.  I chose to movethat to ruleutils.c, since that seems a more reasonable place to beexporting 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 opclasseswith different equality behaviors,#4 seems like an issue worthback-patching.  That's the bulk of the change anyway, so just back-patchthe whole thing to 9.4 where this code was introduced.Discussion:https://postgr.es/m/13836.1521413227@sss.pgh.pa.us
postgres-mirror pushed a commit that referenced this pull requestMar 19, 2018
refresh_by_match_merge() has some issues in the way it builds a SQLquery 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 enforcedby a given index, but just assumes that they must be those of the columndatatype'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 theintended operator when parsing the query.  (This would have been asecurity bug beforeCVE-2018-1058.)5. It's not careful about indexes on system columns.The way tofix#4 is to make use of the existing code in ri_triggers.cfor generating an arbitrary binary operator clause.  I chose to movethat to ruleutils.c, since that seems a more reasonable place to beexporting 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 opclasseswith different equality behaviors,#4 seems like an issue worthback-patching.  That's the bulk of the change anyway, so just back-patchthe whole thing to 9.4 where this code was introduced.Discussion:https://postgr.es/m/13836.1521413227@sss.pgh.pa.us
postgres-mirror pushed a commit that referenced this pull requestMar 19, 2018
refresh_by_match_merge() has some issues in the way it builds a SQLquery 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 enforcedby a given index, but just assumes that they must be those of the columndatatype'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 theintended operator when parsing the query.  (This would have been asecurity bug beforeCVE-2018-1058.)5. It's not careful about indexes on system columns.The way tofix#4 is to make use of the existing code in ri_triggers.cfor generating an arbitrary binary operator clause.  I chose to movethat to ruleutils.c, since that seems a more reasonable place to beexporting 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 opclasseswith different equality behaviors,#4 seems like an issue worthback-patching.  That's the bulk of the change anyway, so just back-patchthe whole thing to 9.4 where this code was introduced.Discussion:https://postgr.es/m/13836.1521413227@sss.pgh.pa.us
postgres-mirror pushed a commit that referenced this pull requestMar 19, 2018
refresh_by_match_merge() has some issues in the way it builds a SQLquery 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 enforcedby a given index, but just assumes that they must be those of the columndatatype'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 theintended operator when parsing the query.  (This would have been asecurity bug beforeCVE-2018-1058.)5. It's not careful about indexes on system columns.The way tofix#4 is to make use of the existing code in ri_triggers.cfor generating an arbitrary binary operator clause.  I chose to movethat to ruleutils.c, since that seems a more reasonable place to beexporting 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 opclasseswith different equality behaviors,#4 seems like an issue worthback-patching.  That's the bulk of the change anyway, so just back-patchthe whole thing to 9.4 where this code was introduced.Discussion:https://postgr.es/m/13836.1521413227@sss.pgh.pa.us
postgres-mirror pushed a commit that referenced this pull requestMar 19, 2018
refresh_by_match_merge() has some issues in the way it builds a SQLquery 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 enforcedby a given index, but just assumes that they must be those of the columndatatype'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 theintended operator when parsing the query.  (This would have been asecurity bug beforeCVE-2018-1058.)5. It's not careful about indexes on system columns.The way tofix#4 is to make use of the existing code in ri_triggers.cfor generating an arbitrary binary operator clause.  I chose to movethat to ruleutils.c, since that seems a more reasonable place to beexporting 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 opclasseswith different equality behaviors,#4 seems like an issue worthback-patching.  That's the bulk of the change anyway, so just back-patchthe whole thing to 9.4 where this code was introduced.Discussion:https://postgr.es/m/13836.1521413227@sss.pgh.pa.us
postgres-mirror pushed a commit that referenced this pull requestFeb 11, 2019
The original setup for dependencies of partitioned objects hadserious problems:1. It did not verify that a drop cascading to a partition-child objectalso cascaded to at least one of the object's partition parents.  Now,normally a child object would share all its dependencies with one oranother parent (e.g. a child index's opclass dependencies would be sharedwith the parent index), so that this oversight is usually harmless.But if some dependency failed to fit this pattern, the child could bedropped while all its parents remain, creating a logically brokensituation.  (It's easy to construct artificial cases that break it,such as attaching an unrelated extension dependency to the child objectand then dropping the extension.  I'm not sure if any less-artificialcases exist.)2. Management of partition dependencies during ATTACH/DETACH PARTITIONwas complicated and buggy; for example, after detaching a partitiontable it was possible to create cases where a formerly-child indexshould be dropped and was not, because the correct set of dependencieshad not been reconstructed.Less seriously, because multiple partition relationships wererepresented identically in pg_depend, there was an order-of-traversaldependency on which partition parent was cited in error messages.We also had some pre-existing order-of-traversal hazards for errormessages related to internal and extension dependencies.  This iscosmetic to users but causes testing problems.Tofix#1, add a check at the end of the partition tree traversalto ensure that at least one partition parent got deleted.  Tofix#2,establish a new policy that partition dependencies are in addition to,not instead of, a child object's usual dependencies; in this wayATTACH/DETACH PARTITION need not cope with adding or removing theusual dependencies.To fix the cosmetic problem, distinguish between primary and secondarypartition dependency entries in pg_depend, by giving them differentdeptypes.  (They behave identically except for having differentpriorities for being cited in error messages.)  This means that theformer 'I' dependency type is replaced with new 'P' and 'S' types.This also fixes a longstanding bug that after handling an internaldependency by recursing to the owning object, findDependentObjectsdid not verify that the current target was now scheduled for deletion,and did not apply the current recursion level's objflags to it.Perhaps that should be back-patched; but in the back branches itwould only matter if some concurrent transaction had removed theinternal-linkage pg_depend entry before the recursive call found it,or the recursive call somehow failed to find it, both of which seemunlikely.Catversion bump because the contents of pg_depend change forpartitioning relationships.Patch HEAD only.  It's annoying that we're not fixing#2 in v11,but there seems no practical way to do so given that the problemis exactly a poor choice of what entries to put in pg_depend.We can't really fix that while staying compatible with what'sin pg_depend in existing v11 installations.Discussion:https://postgr.es/m/CAH2-Wzkypv1R+teZrr71U23J578NnTBt2X8+Y=Odr4pOdW1rXg@mail.gmail.com
postgres-mirror pushed a commit that referenced this pull requestApr 24, 2019
…tions.Commit3d956d9 added support for update row movement in postgres_fdw.This patch fixes the following issues introduced by that commit:* When a remote partition chosen to insert routed rows into was also an  UPDATE subplan target rel that would be updated later, the UPDATE that  used a direct modification plan modified those routed rows incorrectly  because those routed rows were visible to the later UPDATE command.  The right fix for this would be to have some way in postgres_fdw in  which the later UPDATE command ignores those routed rows, but it seems  hard to do so with the current infrastructure.  For now throw an error  in that case.* When a remote partition chosen to insert routed rows into was also an  UPDATE subplan target rel, fmstate created for the UPDATE that used a  non-direct modification plan was mistakenly overridden by another  fmstate created for inserting those routed rows into the partition.  This caused 1) server crash when the partition would be updated later,  and 2) resource leak when the partition had been already updated.  To  avoid that, adjust the treatment of the fmstate for the inserting.  As  for#1, since we would also have the incorrectness issue as mentioned  above, error out in that case as well.Update the docs to mention that postgres_fdw currently does not handlethe case where a remote partition chosen to insert a routed row into isalso an UPDATE subplan target rel that will be updated later.Author: Amit Langote and Etsuro FujitaReviewed-by: Amit LangoteBackpatch-through: 11 where row movement in postgres_fdw was addedDiscussion:https://postgr.es/m/21e7eaa4-0d4d-20c2-a1f7-c7e96f4ce440@lab.ntt.co.jp
postgres-mirror pushed a commit that referenced this pull requestApr 24, 2019
…tions.Commit3d956d9 added support for update row movement in postgres_fdw.This patch fixes the following issues introduced by that commit:* When a remote partition chosen to insert routed rows into was also an  UPDATE subplan target rel that would be updated later, the UPDATE that  used a direct modification plan modified those routed rows incorrectly  because those routed rows were visible to the later UPDATE command.  The right fix for this would be to have some way in postgres_fdw in  which the later UPDATE command ignores those routed rows, but it seems  hard to do so with the current infrastructure.  For now throw an error  in that case.* When a remote partition chosen to insert routed rows into was also an  UPDATE subplan target rel, fmstate created for the UPDATE that used a  non-direct modification plan was mistakenly overridden by another  fmstate created for inserting those routed rows into the partition.  This caused 1) server crash when the partition would be updated later,  and 2) resource leak when the partition had been already updated.  To  avoid that, adjust the treatment of the fmstate for the inserting.  As  for#1, since we would also have the incorrectness issue as mentioned  above, error out in that case as well.Update the docs to mention that postgres_fdw currently does not handlethe case where a remote partition chosen to insert a routed row into isalso an UPDATE subplan target rel that will be updated later.Author: Amit Langote and Etsuro FujitaReviewed-by: Amit LangoteBackpatch-through: 11 where row movement in postgres_fdw was addedDiscussion:https://postgr.es/m/21e7eaa4-0d4d-20c2-a1f7-c7e96f4ce440@lab.ntt.co.jp
@repo-lockdown
Copy link

Thanks for your Pull Request! 😄 This repo on GitHub is just a mirror of our real git repositories though, and can't really handle PRs. 😦 Hopefully you can redo the PR, and direct it to the git.postgresql.org repos? We have a developer guide, if that helps:https://wiki.postgresql.org/wiki/So,_you_want_to_be_a_developer%3F. If this was a PR for pgAdmin, please visithttps://www.pgadmin.org/docs/pgadmin4/dev/submitting_patches.html.

@repo-lockdownrepo-lockdownbot locked and limited conversation to collaboratorsJun 17, 2019
postgres-mirror pushed a commit that referenced this pull requestJul 9, 2021
Due to how pg_size_pretty(bigint) was implemented, it's possible that whengiven a negative number of bytes that the returning value would not matchthe equivalent positive return value when given the equivalent positivenumber of bytes.  This was due to two separate issues.1. The function used bit shifting to convert the number of bytes intolarger units.  The rounding performed by bit shifting is not the same asdividing.  For example -3 >> 1 = -2, but -3 / 2 = -1.  These twooperations are only equivalent with positive numbers.2. The half_rounded() macro rounded towards positive infinity.  This meantthat negative numbers rounded towards zero and positive numbers roundedaway from zero.Here wefix#1 by dividing the values instead of bit shifting.  Wefix#2by adjusting the half_rounded macro always to round away from zero.Additionally, adjust the pg_size_pretty(numeric) function to be moreexplicit that it's using division rather than bit shifting.  A casualobserver might have believed bit shifting was used due to a staticfunction being named numeric_shift_right.  However, that function wascalculating the divisor from the number of bits and performed division.Here we make that more clear.  This change is just cosmetic and does notaffect the return value of the numeric version of the function.Here we also add a set of regression tests both versions ofpg_size_pretty() which test the values directly before and after thefunction switches to the next unit.This bug was introduced in8a1fab3. Prior to that negative values werealways displayed in bytes.Author: Dean Rasheed, David RowleyDiscussion:https://postgr.es/m/CAEZATCXnNW4HsmZnxhfezR5FuiGgp+mkY4AzcL5eRGO4fuadWg@mail.gmail.comBackpatch-through: 9.6, where the bug was introduced.
postgres-mirror pushed a commit that referenced this pull requestJul 9, 2021
Due to how pg_size_pretty(bigint) was implemented, it's possible that whengiven a negative number of bytes that the returning value would not matchthe equivalent positive return value when given the equivalent positivenumber of bytes.  This was due to two separate issues.1. The function used bit shifting to convert the number of bytes intolarger units.  The rounding performed by bit shifting is not the same asdividing.  For example -3 >> 1 = -2, but -3 / 2 = -1.  These twooperations are only equivalent with positive numbers.2. The half_rounded() macro rounded towards positive infinity.  This meantthat negative numbers rounded towards zero and positive numbers roundedaway from zero.Here wefix#1 by dividing the values instead of bit shifting.  Wefix#2by adjusting the half_rounded macro always to round away from zero.Additionally, adjust the pg_size_pretty(numeric) function to be moreexplicit that it's using division rather than bit shifting.  A casualobserver might have believed bit shifting was used due to a staticfunction being named numeric_shift_right.  However, that function wascalculating the divisor from the number of bits and performed division.Here we make that more clear.  This change is just cosmetic and does notaffect the return value of the numeric version of the function.Here we also add a set of regression tests both versions ofpg_size_pretty() which test the values directly before and after thefunction switches to the next unit.This bug was introduced in8a1fab3. Prior to that negative values werealways displayed in bytes.Author: Dean Rasheed, David RowleyDiscussion:https://postgr.es/m/CAEZATCXnNW4HsmZnxhfezR5FuiGgp+mkY4AzcL5eRGO4fuadWg@mail.gmail.comBackpatch-through: 9.6, where the bug was introduced.
postgres-mirror pushed a commit that referenced this pull requestJul 9, 2021
Due to how pg_size_pretty(bigint) was implemented, it's possible that whengiven a negative number of bytes that the returning value would not matchthe equivalent positive return value when given the equivalent positivenumber of bytes.  This was due to two separate issues.1. The function used bit shifting to convert the number of bytes intolarger units.  The rounding performed by bit shifting is not the same asdividing.  For example -3 >> 1 = -2, but -3 / 2 = -1.  These twooperations are only equivalent with positive numbers.2. The half_rounded() macro rounded towards positive infinity.  This meantthat negative numbers rounded towards zero and positive numbers roundedaway from zero.Here wefix#1 by dividing the values instead of bit shifting.  Wefix#2by adjusting the half_rounded macro always to round away from zero.Additionally, adjust the pg_size_pretty(numeric) function to be moreexplicit that it's using division rather than bit shifting.  A casualobserver might have believed bit shifting was used due to a staticfunction being named numeric_shift_right.  However, that function wascalculating the divisor from the number of bits and performed division.Here we make that more clear.  This change is just cosmetic and does notaffect the return value of the numeric version of the function.Here we also add a set of regression tests both versions ofpg_size_pretty() which test the values directly before and after thefunction switches to the next unit.This bug was introduced in8a1fab3. Prior to that negative values werealways displayed in bytes.Author: Dean Rasheed, David RowleyDiscussion:https://postgr.es/m/CAEZATCXnNW4HsmZnxhfezR5FuiGgp+mkY4AzcL5eRGO4fuadWg@mail.gmail.comBackpatch-through: 9.6, where the bug was introduced.
postgres-mirror pushed a commit that referenced this pull requestJul 9, 2021
Due to how pg_size_pretty(bigint) was implemented, it's possible that whengiven a negative number of bytes that the returning value would not matchthe equivalent positive return value when given the equivalent positivenumber of bytes.  This was due to two separate issues.1. The function used bit shifting to convert the number of bytes intolarger units.  The rounding performed by bit shifting is not the same asdividing.  For example -3 >> 1 = -2, but -3 / 2 = -1.  These twooperations are only equivalent with positive numbers.2. The half_rounded() macro rounded towards positive infinity.  This meantthat negative numbers rounded towards zero and positive numbers roundedaway from zero.Here wefix#1 by dividing the values instead of bit shifting.  Wefix#2by adjusting the half_rounded macro always to round away from zero.Additionally, adjust the pg_size_pretty(numeric) function to be moreexplicit that it's using division rather than bit shifting.  A casualobserver might have believed bit shifting was used due to a staticfunction being named numeric_shift_right.  However, that function wascalculating the divisor from the number of bits and performed division.Here we make that more clear.  This change is just cosmetic and does notaffect the return value of the numeric version of the function.Here we also add a set of regression tests both versions ofpg_size_pretty() which test the values directly before and after thefunction switches to the next unit.This bug was introduced in8a1fab3. Prior to that negative values werealways displayed in bytes.Author: Dean Rasheed, David RowleyDiscussion:https://postgr.es/m/CAEZATCXnNW4HsmZnxhfezR5FuiGgp+mkY4AzcL5eRGO4fuadWg@mail.gmail.comBackpatch-through: 9.6, where the bug was introduced.
postgres-mirror pushed a commit that referenced this pull requestJul 9, 2021
Due to how pg_size_pretty(bigint) was implemented, it's possible that whengiven a negative number of bytes that the returning value would not matchthe equivalent positive return value when given the equivalent positivenumber of bytes.  This was due to two separate issues.1. The function used bit shifting to convert the number of bytes intolarger units.  The rounding performed by bit shifting is not the same asdividing.  For example -3 >> 1 = -2, but -3 / 2 = -1.  These twooperations are only equivalent with positive numbers.2. The half_rounded() macro rounded towards positive infinity.  This meantthat negative numbers rounded towards zero and positive numbers roundedaway from zero.Here wefix#1 by dividing the values instead of bit shifting.  Wefix#2by adjusting the half_rounded macro always to round away from zero.Additionally, adjust the pg_size_pretty(numeric) function to be moreexplicit that it's using division rather than bit shifting.  A casualobserver might have believed bit shifting was used due to a staticfunction being named numeric_shift_right.  However, that function wascalculating the divisor from the number of bits and performed division.Here we make that more clear.  This change is just cosmetic and does notaffect the return value of the numeric version of the function.Here we also add a set of regression tests both versions ofpg_size_pretty() which test the values directly before and after thefunction switches to the next unit.This bug was introduced in8a1fab3. Prior to that negative values werealways displayed in bytes.Author: Dean Rasheed, David RowleyDiscussion:https://postgr.es/m/CAEZATCXnNW4HsmZnxhfezR5FuiGgp+mkY4AzcL5eRGO4fuadWg@mail.gmail.comBackpatch-through: 9.6, where the bug was introduced.
postgres-mirror pushed a commit that referenced this pull requestJul 9, 2021
Due to how pg_size_pretty(bigint) was implemented, it's possible that whengiven a negative number of bytes that the returning value would not matchthe equivalent positive return value when given the equivalent positivenumber of bytes.  This was due to two separate issues.1. The function used bit shifting to convert the number of bytes intolarger units.  The rounding performed by bit shifting is not the same asdividing.  For example -3 >> 1 = -2, but -3 / 2 = -1.  These twooperations are only equivalent with positive numbers.2. The half_rounded() macro rounded towards positive infinity.  This meantthat negative numbers rounded towards zero and positive numbers roundedaway from zero.Here wefix#1 by dividing the values instead of bit shifting.  Wefix#2by adjusting the half_rounded macro always to round away from zero.Additionally, adjust the pg_size_pretty(numeric) function to be moreexplicit that it's using division rather than bit shifting.  A casualobserver might have believed bit shifting was used due to a staticfunction being named numeric_shift_right.  However, that function wascalculating the divisor from the number of bits and performed division.Here we make that more clear.  This change is just cosmetic and does notaffect the return value of the numeric version of the function.Here we also add a set of regression tests both versions ofpg_size_pretty() which test the values directly before and after thefunction switches to the next unit.This bug was introduced in8a1fab3. Prior to that negative values werealways displayed in bytes.Author: Dean Rasheed, David RowleyDiscussion:https://postgr.es/m/CAEZATCXnNW4HsmZnxhfezR5FuiGgp+mkY4AzcL5eRGO4fuadWg@mail.gmail.comBackpatch-through: 9.6, where the bug was introduced.
postgres-mirror pushed a commit that referenced this pull requestJul 9, 2021
Due to how pg_size_pretty(bigint) was implemented, it's possible that whengiven a negative number of bytes that the returning value would not matchthe equivalent positive return value when given the equivalent positivenumber of bytes.  This was due to two separate issues.1. The function used bit shifting to convert the number of bytes intolarger units.  The rounding performed by bit shifting is not the same asdividing.  For example -3 >> 1 = -2, but -3 / 2 = -1.  These twooperations are only equivalent with positive numbers.2. The half_rounded() macro rounded towards positive infinity.  This meantthat negative numbers rounded towards zero and positive numbers roundedaway from zero.Here wefix#1 by dividing the values instead of bit shifting.  Wefix#2by adjusting the half_rounded macro always to round away from zero.Additionally, adjust the pg_size_pretty(numeric) function to be moreexplicit that it's using division rather than bit shifting.  A casualobserver might have believed bit shifting was used due to a staticfunction being named numeric_shift_right.  However, that function wascalculating the divisor from the number of bits and performed division.Here we make that more clear.  This change is just cosmetic and does notaffect the return value of the numeric version of the function.Here we also add a set of regression tests both versions ofpg_size_pretty() which test the values directly before and after thefunction switches to the next unit.This bug was introduced in8a1fab3. Prior to that negative values werealways displayed in bytes.Author: Dean Rasheed, David RowleyDiscussion:https://postgr.es/m/CAEZATCXnNW4HsmZnxhfezR5FuiGgp+mkY4AzcL5eRGO4fuadWg@mail.gmail.comBackpatch-through: 9.6, where the bug was introduced.
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@strk@mhagander

[8]ページ先頭

©2009-2025 Movatter.jp