forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5633836
committed
ecpglib: call newlocale() once per process.
ecpglib has been calling it once per SQL query and once per EXEC SQL GETDESCRIPTOR. Instead, if newlocale() has not succeeded before, call itwhile establishing a connection. This mitigates three problems:- If newlocale() failed in EXEC SQL GET DESCRIPTOR, the command silently proceeded without the intended locale change.- On AIX, each newlocale()+freelocale() cycle leaked memory.- newlocale() CPU usage may have been nontrivial.Fail the connection attempt if newlocale() fails. Rearrangeecpg_do_prologue() to validate the connection before its uselocale().The sort of program that may regress is one running in an environmentwhere newlocale() fails. If that program establishes connectionswithout running SQL statements, it will stop working in response to thischange. I'm betting against the importance of such an ECPG use case.Most SQL execution (any using ECPGdo()) has long required newlocale()success, so there's little a connection could do without newlocale().Back-patch to v10 (all supported versions).Reviewed by Tom Lane. Reported by Guillaume Lelarge.Discussion:https://postgr.es/m/20220101074055.GA54621@rfd.leadboat.com1 parent4347071 commit5633836
File tree
4 files changed
+71
-29
lines changed- src/interfaces/ecpg/ecpglib
4 files changed
+71
-29
lines changedLines changed: 40 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 |
| |
14 | 18 |
| |
15 | 19 |
| |
| |||
504 | 508 |
| |
505 | 509 |
| |
506 | 510 |
| |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
507 | 547 |
| |
508 | 548 |
| |
509 | 549 |
| |
|
Lines changed: 10 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
486 | 486 |
| |
487 | 487 |
| |
488 | 488 |
| |
489 |
| - | |
490 |
| - | |
491 |
| - | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
492 | 499 |
| |
493 | 500 |
| |
494 | 501 |
| |
| |||
504 | 511 |
| |
505 | 512 |
| |
506 | 513 |
| |
507 |
| - | |
508 |
| - | |
509 | 514 |
| |
510 | 515 |
| |
511 | 516 |
| |
|
Lines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
62 | 66 |
| |
63 | 67 |
| |
64 | 68 |
| |
| |||
73 | 77 |
| |
74 | 78 |
| |
75 | 79 |
| |
76 |
| - | |
77 | 80 |
| |
78 | 81 |
| |
79 | 82 |
| |
|
Lines changed: 17 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
101 | 101 |
| |
102 | 102 |
| |
103 | 103 |
| |
104 |
| - | |
105 |
| - | |
106 |
| - | |
107 |
| - | |
| 104 | + | |
108 | 105 |
| |
109 | 106 |
| |
110 | 107 |
| |
| |||
1965 | 1962 |
| |
1966 | 1963 |
| |
1967 | 1964 |
| |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
1968 | 1974 |
| |
1969 | 1975 |
| |
1970 | 1976 |
| |
| |||
1979 | 1985 |
| |
1980 | 1986 |
| |
1981 | 1987 |
| |
1982 |
| - | |
1983 |
| - | |
1984 |
| - | |
1985 |
| - | |
1986 |
| - | |
1987 |
| - | |
1988 |
| - | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
1989 | 1995 |
| |
1990 | 1996 |
| |
1991 | 1997 |
| |
| |||
2004 | 2010 |
| |
2005 | 2011 |
| |
2006 | 2012 |
| |
2007 |
| - | |
2008 |
| - | |
2009 |
| - | |
2010 |
| - | |
2011 |
| - | |
2012 |
| - | |
2013 |
| - | |
2014 |
| - | |
2015 |
| - | |
2016 |
| - | |
2017 |
| - | |
2018 |
| - | |
2019 | 2013 |
| |
2020 | 2014 |
| |
2021 | 2015 |
| |
|
0 commit comments
Comments
(0)