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

Commit83bed06

Browse files
committed
Rationalize format-picture caching logic in formatting.c.
Add a validity flag to DCHCacheEntry and NUMCacheEntry entries, anddo not set it true until after we've parsed the supplied format string.This allows dealing with possible errors while parsing the formatwithout the baroque hack that was there before (which only coverederrors within NUMDesc_prepare, anyway). We can get rid of the PG_TRY inNUMDesc_prepare, as well as last_NUMCacheEntry and NUM_cache_remove.(Essentially, this reverts commitff783fb in favor of a less fragilesolution; the problems with that approach are well illustrated by laterhacking such as55f927a.)In passing, define the size of these caches as DCH_CACHE_ENTRIES notDCH_CACHE_FIELDS + 1 (whoever thought that was a good definition?)and likewise for the NUM cache. Also const-ify format string parameterswhere convenient, and merge duplicated cache lookup logic.This is primarily driven by a proposed patch from Artur Zakirov,which introduced some ereport's into format string parsing forthe datetime case. He proposed preventing the creation of invalidcache entries by parsing the format string first into a local-variablearray, and then copying that to a cache entry. That seemed a bitugly to me, and anyway randomly different from the way the identicalproblem had been solved for the numeric case. Let's make the twosets of code more similar not less so.I'm not sure whether we'll adopt the new error conditions Artur proposes,but this patch seems like good code cleanup and future-proofing in anycase. The existing code is critically (and undocumented-ly) dependent onno elog being thrown out of several nontrivial functions, which is troublewaiting to happen, though it doesn't seem to be actively broken today.Discussion: <b2a39359-3282-b402-f4a3-057aae500ee7@postgrespro.ru>
1 parentd3cd36a commit83bed06

File tree

1 file changed

+292
-310
lines changed

1 file changed

+292
-310
lines changed

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp