-
- Downloads
Fix collation handling in plpgsql functions.
Make plpgsql treat the input collation as a polymorphism variable, so that we cache separate plans for each input collation that's used in a particular session, as per recent discussion. Propagate the input collation to all collatable input parameters. I chose to also propagate the input collation to all declared variables of collatable types, which is a bit more debatable but seems to be necessary for non-astonishing behavior. (Copying a parameter into a separate local variable shouldn't result in a change of behavior, for example.) There is enough infrastructure here to support declaring a collation for each local variable to override that default, but I thought we should wait to see what the field demand is before adding such a feature. In passing, remove exec_get_rec_fieldtype(), which wasn't used anywhere. Documentation patch to follow.
Showing
- src/pl/plpgsql/src/gram.y 15 additions, 6 deletionssrc/pl/plpgsql/src/gram.y
- src/pl/plpgsql/src/pl_comp.c 71 additions, 27 deletionssrc/pl/plpgsql/src/pl_comp.c
- src/pl/plpgsql/src/pl_exec.c 56 additions, 23 deletionssrc/pl/plpgsql/src/pl_exec.c
- src/pl/plpgsql/src/plpgsql.h 14 additions, 4 deletionssrc/pl/plpgsql/src/plpgsql.h
- src/test/regress/expected/collate.linux.utf8.out 43 additions, 39 deletionssrc/test/regress/expected/collate.linux.utf8.out
- src/test/regress/sql/collate.linux.utf8.sql 8 additions, 3 deletionssrc/test/regress/sql/collate.linux.utf8.sql
Loading
Please register or sign in to comment