{"Entry":{"collection":"hook","key":"get_attavgwidth_hook","name":"get_attavgwidth_hook","aliases":[],"metadata":{"aliases":[],"category":"Statistics and estimation","content_hash":"04af6adb045a56da90e5fc2cd1899ee585db95a6076187116b4157aba2448317","derived_content_hash":"3e072643698b193cfed11e0a0f570a20936d91a2646db45c075eb94297265351","imported_at":"2026-09-27T17:57:58.894076+08:00","name":"get_attavgwidth_hook","name_zh":"get_attavgwidth_hook","repair_provenance":{"original_source_revision":"","receipt_sha256":"a4d2eca92b2516aa2c04731b6649bc9a7cd0e1b7a4dc28ab6d4ae8225217fc28","repair":"wiki-repair-20261023"},"slug":"get_attavgwidth_hook","source_rev":"wiki-repair-20261023:a32341a22f2ec0982bad368134053fc30d945f8a5b16f01e591dd5722076c994","summary":"Hook for plugins to get control in get_attavgwidth()"}},"Definition":{"Collection":"hook","Key":"get_attavgwidth_hook","SourceDatabase":"center","Version":"18","SourceTable":"hook","SourceKey":"get_attavgwidth_hook","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","Facts":{"description":["Hook for plugins to get control in get_attavgwidth()"],"description_zh":"供插件在 get_attavgwidth() 中接管处理的钩子。","description_zh_html":"\u003cp\u003e供插件在 get_attavgwidth() 中接管处理的钩子。\u003c/p\u003e\u003cp\u003e以下中文为本站依据所列 PostgreSQL 源码注释编译的说明。\u003c/p\u003e\u003ch3\u003e接口声明\u003c/h3\u003e\u003cpre\u003etypedef int32 (*get_attavgwidth_hook_type) (Oid relid, AttrNumber attnum);\nextern PGDLLIMPORT get_attavgwidth_hook_type get_attavgwidth_hook;\u003c/pre\u003e\u003ch3\u003e调用位置\u003c/h3\u003e\u003cul\u003e\u003cli\u003e\u003ccode\u003esrc/backend/utils/cache/lsyscache.c:3467\u003c/code\u003e\u003c/li\u003e\u003c/ul\u003e\u003ch3\u003e核心调用上下文：src/backend/utils/cache/lsyscache.c:3461–3475\u003c/h3\u003e\u003cpre\u003e{\n\tHeapTuple\ttp;\n\tint32\t\tstawidth;\n\n\tif (get_attavgwidth_hook)\n\t{\n\t\tstawidth = (*get_attavgwidth_hook) (relid, attnum);\n\t\tif (stawidth \u0026gt; 0)\n\t\t\treturn stawidth;\n\t}\n\ttp = SearchSysCache3(STATRELATTINH,\n\t\t\t\t\t\t ObjectIdGetDatum(relid),\n\t\t\t\t\t\t Int16GetDatum(attnum),\n\t\t\t\t\t\t BoolGetDatum(false));\n\tif (HeapTupleIsValid(tp))\u003c/pre\u003e","facts":[{"label":"Interface type","value":"get_attavgwidth_hook_type"},{"label":"Header","value":"src/include/utils/lsyscache.h"},{"label":"Subsystem","value":"Statistics and estimation"},{"label":"Initial value","value":"NULL (no hook installed)"}],"related":[{"label":"The Planner/Optimizer","url":"/docs/18/planner-optimizer.html"}],"release":{"channel":"stable","label":"18","major":"18","ref":"REL_18_STABLE","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd"},"sections":[{"paragraphs":["src/backend/utils/cache/lsyscache.c:3467"],"title":"Call sites"},{"code":"{\n\tHeapTuple\ttp;\n\tint32\t\tstawidth;\n\n\tif (get_attavgwidth_hook)\n\t{\n\t\tstawidth = (*get_attavgwidth_hook) (relid, attnum);\n\t\tif (stawidth \u003e 0)\n\t\t\treturn stawidth;\n\t}\n\ttp = SearchSysCache3(STATRELATTINH,\n\t\t\t\t\t\t ObjectIdGetDatum(relid),\n\t\t\t\t\t\t Int16GetDatum(attnum),\n\t\t\t\t\t\t BoolGetDatum(false));\n\tif (HeapTupleIsValid(tp))","paragraphs":[],"title":"Core call context: src/backend/utils/cache/lsyscache.c:3461–3475"}],"signature":"typedef int32 (*get_attavgwidth_hook_type) (Oid relid, AttrNumber attnum);\nextern PGDLLIMPORT get_attavgwidth_hook_type get_attavgwidth_hook;","sources":[{"label":"Interface declaration","path":"src/include/utils/lsyscache.h","sha256":"48ab9cc15af02106e6710ea04b2738e8aea75b4956934ea8ec109c8c49daa834","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/utils/lsyscache.h#L66"},{"label":"Core definition","path":"src/backend/utils/cache/lsyscache.c","sha256":"43a22e20685c043936ddfeee032d0c06d9408d7edbadfa9417a2ede32e70b97d","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/cache/lsyscache.c#L54"},{"label":"Call sites","path":"src/backend/utils/cache/lsyscache.c","sha256":"43a22e20685c043936ddfeee032d0c06d9408d7edbadfa9417a2ede32e70b97d","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/cache/lsyscache.c#L3467"}],"translation_provenance":{"inputs":[{"label":"Interface declaration","path":"src/include/utils/lsyscache.h","sha256":"48ab9cc15af02106e6710ea04b2738e8aea75b4956934ea8ec109c8c49daa834","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/utils/lsyscache.h#L66"},{"label":"Core definition","path":"src/backend/utils/cache/lsyscache.c","sha256":"43a22e20685c043936ddfeee032d0c06d9408d7edbadfa9417a2ede32e70b97d","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/cache/lsyscache.c#L54"},{"label":"Call sites","path":"src/backend/utils/cache/lsyscache.c","sha256":"43a22e20685c043936ddfeee032d0c06d9408d7edbadfa9417a2ede32e70b97d","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/cache/lsyscache.c#L3467"}],"kind":"authored-source-translation","locale":"zh-Hans","source_revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","translated_source_sha256":"8a5d14fd2e35e246843ce5aef9b99cb1d7a4190f8f32aa8523c6e11f4194ca69","version":"18"},"zh_from":"authored-source-translation"},"ManualEvidence":{"release":{"channel":"stable","label":"18","major":"18","ref":"REL_18_STABLE","revision":"753057e340da8f22e57c9a409ea7a235fd6a46bd"},"sources":[{"label":"Interface declaration","path":"src/include/utils/lsyscache.h","sha256":"48ab9cc15af02106e6710ea04b2738e8aea75b4956934ea8ec109c8c49daa834","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/include/utils/lsyscache.h#L66"},{"label":"Core definition","path":"src/backend/utils/cache/lsyscache.c","sha256":"43a22e20685c043936ddfeee032d0c06d9408d7edbadfa9417a2ede32e70b97d","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/cache/lsyscache.c#L54"},{"label":"Call sites","path":"src/backend/utils/cache/lsyscache.c","sha256":"43a22e20685c043936ddfeee032d0c06d9408d7edbadfa9417a2ede32e70b97d","url":"https://github.com/postgres/postgres/blob/753057e340da8f22e57c9a409ea7a235fd6a46bd/src/backend/utils/cache/lsyscache.c#L3467"}]},"MeasuredEvidence":{}},"Text":{"Collection":"hook","Key":"get_attavgwidth_hook","SourceDatabase":"center","Version":"18","Locale":"en","Title":"get_attavgwidth_hook","Summary":"Hook for plugins to get control in get_attavgwidth()","BodyHTML":"\u003cp\u003eHook for plugins to get control in get_attavgwidth()\u003c/p\u003e","SourceRevision":"753057e340da8f22e57c9a409ea7a235fd6a46bd","ContentHash":"a712e79df66a6094456a9aa2e645d7eb98a199c3dd604755b62de847ae589329","Payload":{"description":["Hook for plugins to get control in get_attavgwidth()"],"related":[{"label":"The Planner/Optimizer","url":"/docs/18/planner-optimizer.html"}],"sections":[{"paragraphs":["src/backend/utils/cache/lsyscache.c:3467"],"title":"Call sites"},{"code":"{\n\tHeapTuple\ttp;\n\tint32\t\tstawidth;\n\n\tif (get_attavgwidth_hook)\n\t{\n\t\tstawidth = (*get_attavgwidth_hook) (relid, attnum);\n\t\tif (stawidth \u003e 0)\n\t\t\treturn stawidth;\n\t}\n\ttp = SearchSysCache3(STATRELATTINH,\n\t\t\t\t\t\t ObjectIdGetDatum(relid),\n\t\t\t\t\t\t Int16GetDatum(attnum),\n\t\t\t\t\t\t BoolGetDatum(false));\n\tif (HeapTupleIsValid(tp))","paragraphs":[],"title":"Core call context: src/backend/utils/cache/lsyscache.c:3461–3475"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
