{"Entry":{"collection":"func","key":"array-position","name":"array_position","aliases":[],"metadata":{"changed_in":["14"],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"9.4","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"9.5"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"},{"descriptions_changed":false,"doc_overhaul":false,"from":"13","group_changed":null,"signatures":{"added":["array_position ( anycompatiblearray, anycompatible [, integer ] ) → integer"],"removed":["array_position ( anyarray, anyelement [, integer ] ) → integer"]},"status":"changed","to":"14"}],"content_hash":"6de230dcf75f8eef191fea65f71c48cc23ec065a84ac5b61657541ecd671c00c","first_version":"9.5","group":"array","group_label":"Array Functions And Operators","groups":["array"],"imported_at":"2026-09-14T21:49:48.831862+08:00","last_version":"20","name":"array_position","name_key":"array_position","position":19007,"present_in":["9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"signature":"array_position ( anycompatiblearray, anycompatible [, integer ] ) → integer","signature_count":1,"slug":"array-position","source_rev":"2026-09-14T13:14:25.684213+00:00@99e6866c","summary":"Returns the subscript of the first occurrence of the second argument in the array, or NULL if it's not present.","summary_zh":""}},"Definition":{"Collection":"func","Key":"array-position","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"array-position","SourceRevision":"2026-09-14T13:14:25.684213+00:00@99e6866c","Facts":{"description":"Returns the subscript of the first occurrence of the second argument in the array, or NULL if it's not present. If the third argument is given, the search begins at that subscript. The array must be one-dimensional. Comparisons are done using IS NOT DISTINCT FROM semantics, so it is possible to search for NULL.","description_html":"Returns the subscript of the first occurrence of the second argument in the array, or \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e if it's not present. If the third argument is given, the search begins at that subscript. The array must be one-dimensional. Comparisons are done using \u003ccode class=\"literal\"\u003eIS NOT DISTINCT FROM\u003c/code\u003e semantics, so it is possible to search for \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.","description_zh":"","description_zh_html":"","doc":{"anchor":"ARRAY-FUNCTIONS-TABLE","file":"functions-array.html","slug":"18"},"group":"array","group_label":"Array Functions And Operators","lang":"en","layout":"table-new","pages":["functions-array.html"],"prose_only":false,"signatures":[{"description":"Returns the subscript of the first occurrence of the second argument in the array, or NULL if it's not present. If the third argument is given, the search begins at that subscript. The array must be one-dimensional. Comparisons are done using IS NOT DISTINCT FROM semantics, so it is possible to search for NULL.","description_html":"Returns the subscript of the first occurrence of the second argument in the array, or \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e if it's not present. If the third argument is given, the search begins at that subscript. The array must be one-dimensional. Comparisons are done using \u003ccode class=\"literal\"\u003eIS NOT DISTINCT FROM\u003c/code\u003e semantics, so it is possible to search for \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"array_position(ARRAY['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'], 'mon')","result":"2"}],"html":"\u003ccode class=\"function\"\u003earray_position\u003c/code\u003e ( \u003ccode class=\"type\"\u003eanycompatiblearray\u003c/code\u003e, \u003ccode class=\"type\"\u003eanycompatible\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003ccode class=\"type\"\u003einteger\u003c/code\u003e\u003c/span\u003e ] ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"array_position ( anycompatiblearray, anycompatible [, integer ] ) → integer","zh_from":""}],"zh_from":""},"ManualEvidence":{"doc":{"anchor":"ARRAY-FUNCTIONS-TABLE","file":"functions-array.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"array-position","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"array_position","Summary":"返回第二个参数在数组中首次出现的下标；若不存在，则返回NULL。如果给出了第三个参数，则搜索从该下标开始。数组必须是一维的。比较是使用IS NOT DISTINCT FROM语义进行的，所以可以搜索NULL。","BodyHTML":"返回第二个参数在数组中首次出现的下标；若不存在，则返回\u003ccode\u003eNULL\u003c/code\u003e。如果给出了第三个参数，则搜索从该下标开始。数组必须是一维的。比较是使用\u003ccode\u003eIS NOT DISTINCT FROM\u003c/code\u003e语义进行的，所以可以搜索\u003ccode\u003eNULL\u003c/code\u003e。\u003cpre\u003earray_position ( anycompatiblearray, anycompatible [, integer ] ) → integer\u003c/pre\u003e返回第二个参数在数组中首次出现的下标；若不存在，则返回\u003ccode\u003eNULL\u003c/code\u003e。如果给出了第三个参数，则搜索从该下标开始。数组必须是一维的。比较是使用\u003ccode\u003eIS NOT DISTINCT FROM\u003c/code\u003e语义进行的，所以可以搜索\u003ccode\u003eNULL\u003c/code\u003e。","SourceRevision":"1b5ca64c","ContentHash":"38dab68c84336055081454c6d2f94639bedd5d4466309786bbe30e79bc7bae01","Payload":{"description_zh":"返回第二个参数在数组中首次出现的下标；若不存在，则返回NULL。如果给出了第三个参数，则搜索从该下标开始。数组必须是一维的。比较是使用IS NOT DISTINCT FROM语义进行的，所以可以搜索NULL。","description_zh_html":"返回第二个参数在数组中首次出现的下标；若不存在，则返回\u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e。如果给出了第三个参数，则搜索从该下标开始。数组必须是一维的。比较是使用\u003ccode class=\"literal\"\u003eIS NOT DISTINCT FROM\u003c/code\u003e语义进行的，所以可以搜索\u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e。","signatures":[{"description_zh":"返回第二个参数在数组中首次出现的下标；若不存在，则返回NULL。如果给出了第三个参数，则搜索从该下标开始。数组必须是一维的。比较是使用IS NOT DISTINCT FROM语义进行的，所以可以搜索NULL。","description_zh_html":"返回第二个参数在数组中首次出现的下标；若不存在，则返回\u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e。如果给出了第三个参数，则搜索从该下标开始。数组必须是一维的。比较是使用\u003ccode class=\"literal\"\u003eIS NOT DISTINCT FROM\u003c/code\u003e语义进行的，所以可以搜索\u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e。","returns":"integer","text":"array_position ( anycompatiblearray, anycompatible [, integer ] ) → integer","zh_from":"doc"}],"zh_from":"doc"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"9613e2713b6bedc41930538c0a2918972e5c3171b8621e7859a643b5a377ec69","Text":"array_position ( anycompatiblearray, anycompatible [, integer ] ) → integer","Returns":"integer","Payload":{"description":"Returns the subscript of the first occurrence of the second argument in the array, or NULL if it's not present. If the third argument is given, the search begins at that subscript. The array must be one-dimensional. Comparisons are done using IS NOT DISTINCT FROM semantics, so it is possible to search for NULL.","description_html":"Returns the subscript of the first occurrence of the second argument in the array, or \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e if it's not present. If the third argument is given, the search begins at that subscript. The array must be one-dimensional. Comparisons are done using \u003ccode class=\"literal\"\u003eIS NOT DISTINCT FROM\u003c/code\u003e semantics, so it is possible to search for \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"array_position(ARRAY['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'], 'mon')","result":"2"}],"html":"\u003ccode class=\"function\"\u003earray_position\u003c/code\u003e ( \u003ccode class=\"type\"\u003eanycompatiblearray\u003c/code\u003e, \u003ccode class=\"type\"\u003eanycompatible\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003ccode class=\"type\"\u003einteger\u003c/code\u003e\u003c/span\u003e ] ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"array_position ( anycompatiblearray, anycompatible [, integer ] ) → integer","zh_from":""}}],"Spellings":null,"SQLState":null,"Evidence":null}
