{"Entry":{"collection":"sql","key":"load","name":"LOAD","aliases":["load"],"metadata":{"aliases":["load"],"changed_in":[],"changes":[{"from":"6.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["usage"],"removed":[]},"status":"changed","synopsis":null,"to":"6.5"},{"from":"7.0","purpose_changed":false,"renamed":{"from_file":"sql-load.htm","to_file":"sql-load.html"},"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":null,"to":"7.1"},{"from":"7.1","purpose_changed":true,"renamed":null,"sections":{"added":["see_also"],"changed":["description","compatibility"],"removed":["usage"]},"status":"changed","synopsis":null,"to":"7.2"},{"from":"7.3","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","see_also"],"removed":[]},"status":"changed","synopsis":null,"to":"7.4"},{"from":"7.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"8.0"},{"from":"8.0","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"8.1"},{"from":"8.1","purpose_changed":true,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"8.2"},{"from":"8.2","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"8.3"},{"from":"8.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"9.0"},{"from":"9.5","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"9.6"},{"from":"9.6","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"10"},{"from":"10","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"11"},{"from":"11","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"12"},{"from":"13","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"14"},{"from":"16","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"17"}],"content_hash":"4c50821898244af2e6748aba3c6d886a6367fd1751d663e4c9bf021331bc344b","editorial":{},"first_version":"6.4","group":"extension","imported_at":"2026-09-30T17:43:38.488514+08:00","last_version":"20","name":"LOAD","object":"","position":7000,"present_in":["6.4","6.5","7.0","7.1","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"purpose":"load a shared library file","purpose_zh":"","related":["create-function"],"slug":"load","source_rev":"a709ab85","synopsis":"LOAD 'filename'","verb":"LOAD"}},"Definition":{"Collection":"sql","Key":"load","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"load","SourceRevision":"a709ab85","Facts":{"anchor":"SQL-LOAD","file":"sql-load.html","lang":"en","name":"LOAD","purpose":"load a shared library file","purpose_zh":"","related":["create-function"],"sections":[{"html":"\u003cp\u003eThis command loads a shared library file into the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e server's address space. If the file has been loaded already, the command does nothing. Shared library files that contain C functions are automatically loaded whenever one of their functions is called. Therefore, an explicit \u003ccode class=\"command\"\u003eLOAD\u003c/code\u003e is usually only needed to load a library that modifies the server's behavior through \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ehooks\u003c/span\u003e”\u003c/span\u003e rather than providing a set of functions.\u003c/p\u003e\u003cp\u003eThe library file name is typically given as just a bare file name, which is sought in the server's library search path (set by \u003ca href=\"/docs/18/runtime-config-client.html#GUC-DYNAMIC-LIBRARY-PATH\"\u003edynamic_library_path\u003c/a\u003e). Alternatively it can be given as a full path name. In either case the platform's standard shared library file name extension may be omitted. See \u003ca href=\"/docs/18/xfunc-c.html#XFUNC-C-DYNLOAD\" title=\"36.10.1. Dynamic Loading\"\u003eSection 36.10.1\u003c/a\u003e for more information on this topic.\u003c/p\u003e\u003cp\u003eNon-superusers can only apply \u003ccode class=\"command\"\u003eLOAD\u003c/code\u003e to library files located in \u003ccode class=\"filename\"\u003e$libdir/plugins/\u003c/code\u003e — the specified \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e must begin with exactly that string. (It is the database administrator's responsibility to ensure that only \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003esafe\u003c/span\u003e”\u003c/span\u003e libraries are installed there.)\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eLOAD\u003c/code\u003e is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cp\u003e\u003ca href=\"/wiki/sql/create-function/?v=18\" title=\"CREATE FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE FUNCTION\u003c/span\u003e\u003c/a\u003e\u003c/p\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"LOAD '\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e'","synopsis_text":"LOAD 'filename'"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"load","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"LOAD","Summary":"载入共享库文件","BodyHTML":"\u003cpre\u003eLOAD \u0026#39;filename\u0026#39;\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e该命令将一个共享库文件载入\u003cspan\u003ePostgreSQL\u003c/span\u003e服务器的地址空间。如果该文件已经载入过，则此命令不执行任何操作。包含 C 函数的共享库文件会在调用其中某个函数时自动载入。因此，显式执行\u003ccode\u003eLOAD\u003c/code\u003e通常只在要载入的是通过\u003cspan\u003e“\u003cspan\u003e钩子\u003c/span\u003e”\u003c/span\u003e修改服务器行为、而不是提供一组函数的库时才有需要。\u003c/p\u003e\u003cp\u003e库文件名通常只给出文件名本身，系统会在服务器的库搜索路径中查找它（该路径由\u003ca href=\"/docs/18/runtime-config-client.html#GUC-DYNAMIC-LIBRARY-PATH\" rel=\"nofollow\"\u003edynamic_library_path\u003c/a\u003e设置）。也可以给出完整路径名。无论哪种情况，都可以省略平台标准的共享库文件名扩展。关于此主题的更多信息，见\u003ca href=\"/docs/18/xfunc-c.html#XFUNC-C-DYNLOAD\" rel=\"nofollow\"\u003e第 36.10.1 节\u003c/a\u003e。\u003c/p\u003e\u003cp\u003e非超级用户只能将\u003ccode\u003eLOAD\u003c/code\u003e用于位于 \u003ccode\u003e$libdir/plugins/\u003c/code\u003e中的库文件，也就是说，指定的 \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e必须严格以该字符串开头。（确保那里只安装了\u003cspan\u003e“\u003cspan\u003e安全\u003c/span\u003e”\u003c/span\u003e的库，是数据库管理员的责任。）\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eLOAD\u003c/code\u003e是\u003cspan\u003ePostgreSQL\u003c/span\u003e的一种扩展。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cp\u003e\u003ca href=\"/wiki/sql/create-function/?v=18\" title=\"CREATE FUNCTION\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE FUNCTION\u003c/span\u003e\u003c/a\u003e\u003c/p\u003e\u003c/section\u003e","SourceRevision":"1b5ca64c","ContentHash":"178ce15349c20044c1d6abaae318cf8af501017a018cb4816ff887527633c8df","Payload":{"purpose_zh":"载入共享库文件","sections":[{"html":"\u003cp\u003e该命令将一个共享库文件载入\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e服务器的地址空间。如果该文件已经载入过，则此命令不执行任何操作。包含 C 函数的共享库文件会在调用其中某个函数时自动载入。因此，显式执行\u003ccode class=\"command\"\u003eLOAD\u003c/code\u003e通常只在要载入的是通过\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e钩子\u003c/span\u003e”\u003c/span\u003e修改服务器行为、而不是提供一组函数的库时才有需要。\u003c/p\u003e\u003cp\u003e库文件名通常只给出文件名本身，系统会在服务器的库搜索路径中查找它（该路径由\u003ca href=\"/docs/18/runtime-config-client.html#GUC-DYNAMIC-LIBRARY-PATH\"\u003edynamic_library_path\u003c/a\u003e设置）。也可以给出完整路径名。无论哪种情况，都可以省略平台标准的共享库文件名扩展。关于此主题的更多信息，见\u003ca href=\"/docs/18/xfunc-c.html#XFUNC-C-DYNLOAD\" title=\"36.10.1. 动态载入\"\u003e第 36.10.1 节\u003c/a\u003e。\u003c/p\u003e\u003cp\u003e非超级用户只能将\u003ccode class=\"command\"\u003eLOAD\u003c/code\u003e用于位于 \u003ccode class=\"filename\"\u003e$libdir/plugins/\u003c/code\u003e中的库文件，也就是说，指定的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e必须严格以该字符串开头。（确保那里只安装了\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e安全\u003c/span\u003e”\u003c/span\u003e的库，是数据库管理员的责任。）\u003c/p\u003e","key":"description","title":"描述"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eLOAD\u003c/code\u003e是\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e的一种扩展。\u003c/p\u003e","key":"compatibility","title":"兼容性"},{"html":"\u003cp\u003e\u003ca href=\"/wiki/sql/create-function/?v=18\" title=\"CREATE FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE FUNCTION\u003c/span\u003e\u003c/a\u003e\u003c/p\u003e","key":"see_also","title":"另见"}],"sections_same_as":"","synopsis_html":"LOAD '\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e'","synopsis_text":"LOAD 'filename'"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","6.4","6.5","7.0","7.1","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
