{"Entry":{"collection":"func","key":"get-bit","name":"get_bit","aliases":[],"metadata":{"changed_in":["8.1"],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"7.2","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"7.3"},{"descriptions_changed":false,"doc_overhaul":false,"from":"8.0","group_changed":null,"signatures":{"added":["get_bit ( string, offset ) → int"],"removed":["get_bit ( string, offset ) → integer"]},"status":"changed","to":"8.1"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"}],"content_hash":"f532b4d7c21fc506faaea40fe4a0fe67e2c509d24281b4eaa37fae2193d4d669","first_version":"7.3","group":"binarystring","group_label":"Binary String Functions And Operators","groups":["binarystring","bitstring"],"imported_at":"2026-09-27T17:57:28.47986+08:00","last_version":"20","name":"get_bit","name_key":"get_bit","position":4008,"present_in":["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"],"signature":"get_bit ( bytes bytea, n bigint ) → integer","signature_count":2,"slug":"get-bit","source_rev":"b7bd9cda","summary":"Extracts n'th bit from binary string.","summary_zh":""}},"Definition":{"Collection":"func","Key":"get-bit","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"get-bit","SourceRevision":"b7bd9cda","Facts":{"description":"Extracts n'th bit from binary string.","description_html":"Extracts \u003ca href=\"/docs/18/functions-binarystring.html#FUNCTIONS-ZEROBASED-NOTE\"\u003en'th\u003c/a\u003e bit from binary string.","description_zh":"","description_zh_html":"","doc":{"anchor":"FUNCTIONS-BINARYSTRING-OTHER","file":"functions-binarystring.html","slug":"18"},"group":"binarystring","group_label":"Binary String Functions And Operators","lang":"en","layout":"table-new","pages":["functions-binarystring.html","functions-bitstring.html"],"prose_only":false,"signatures":[{"description":"Extracts n'th bit from binary string.","description_html":"Extracts \u003ca href=\"/docs/18/functions-binarystring.html#FUNCTIONS-ZEROBASED-NOTE\"\u003en'th\u003c/a\u003e bit from binary string.","description_zh":"","description_zh_html":"","examples":[{"expr":"get_bit('\\x1234567890'::bytea, 30)","result":"1"}],"html":"\u003ccode class=\"function\"\u003eget_bit\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ebytes\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ebigint\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"get_bit ( bytes bytea, n bigint ) → integer","zh_from":""},{"description":"Extracts n'th bit from bit string; the first (leftmost) bit is bit 0.","description_html":"Extracts \u003cem class=\"parameter\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/em\u003e'th bit from bit string; the first (leftmost) bit is bit 0.","description_zh":"","description_zh_html":"","examples":[{"expr":"get_bit(B'101010101010101010', 6)","result":"1"}],"html":"\u003ccode class=\"function\"\u003eget_bit\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ebits\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ebit\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003einteger\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"get_bit ( bits bit, n integer ) → integer","zh_from":""}],"zh_from":""},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-BINARYSTRING-OTHER","file":"functions-binarystring.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"get-bit","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"get_bit","Summary":"从二进制字符串中提取编号为 n 的位。","BodyHTML":"从二进制字符串中提取\u003ca href=\"/docs/18/functions-binarystring.html#FUNCTIONS-ZEROBASED-NOTE\" rel=\"nofollow\"\u003e编号为 n 的\u003c/a\u003e位。\u003cpre\u003eget_bit ( bytes bytea, n bigint ) → integer\u003c/pre\u003e从二进制字符串中提取\u003ca href=\"/docs/18/functions-binarystring.html#FUNCTIONS-ZEROBASED-NOTE\" rel=\"nofollow\"\u003e编号为 n 的\u003c/a\u003e位。\u003cpre\u003eget_bit ( bits bit, n integer ) → integer\u003c/pre\u003e从位串中提取编号为\u003cem\u003e\u003ccode\u003en\u003c/code\u003e\u003c/em\u003e的位；第一位（最左侧的位）编号为位 0。","SourceRevision":"ca936764","ContentHash":"f8af5fc978c2a74c0377969f8e926262fb7f95e11bead2b4fa2d5b94c0f05e01","Payload":{"description_zh":"从二进制字符串中提取编号为 n 的位。","description_zh_html":"从二进制字符串中提取\u003ca href=\"/docs/18/functions-binarystring.html#FUNCTIONS-ZEROBASED-NOTE\"\u003e编号为 n 的\u003c/a\u003e位。","signatures":[{"description_zh":"从二进制字符串中提取编号为 n 的位。","description_zh_html":"从二进制字符串中提取\u003ca href=\"/docs/18/functions-binarystring.html#FUNCTIONS-ZEROBASED-NOTE\"\u003e编号为 n 的\u003c/a\u003e位。","returns":"integer","text":"get_bit ( bytes bytea, n bigint ) → integer","zh_from":"doc"},{"description_zh":"从位串中提取编号为n的位；第一位（最左侧的位）编号为位 0。","description_zh_html":"从位串中提取编号为\u003cem class=\"parameter\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/em\u003e的位；第一位（最左侧的位）编号为位 0。","returns":"integer","text":"get_bit ( bits bit, n 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","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":[{"Version":"18","Ordinal":0,"Hash":"45e0630844022c9fe523a0d8ded714a1160014ceee2ce26a99fd0cc39c4df5ff","Text":"get_bit ( bytes bytea, n bigint ) → integer","Returns":"integer","Payload":{"description":"Extracts n'th bit from binary string.","description_html":"Extracts \u003ca href=\"/docs/18/functions-binarystring.html#FUNCTIONS-ZEROBASED-NOTE\"\u003en'th\u003c/a\u003e bit from binary string.","description_zh":"","description_zh_html":"","examples":[{"expr":"get_bit('\\x1234567890'::bytea, 30)","result":"1"}],"html":"\u003ccode class=\"function\"\u003eget_bit\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ebytes\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ebigint\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"get_bit ( bytes bytea, n bigint ) → integer","zh_from":""}},{"Version":"18","Ordinal":1,"Hash":"a2bdb29ffcb4a6c624938f46624c048ee14c28cabb8ed58842b343d7463f9b69","Text":"get_bit ( bits bit, n integer ) → integer","Returns":"integer","Payload":{"description":"Extracts n'th bit from bit string; the first (leftmost) bit is bit 0.","description_html":"Extracts \u003cem class=\"parameter\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/em\u003e'th bit from bit string; the first (leftmost) bit is bit 0.","description_zh":"","description_zh_html":"","examples":[{"expr":"get_bit(B'101010101010101010', 6)","result":"1"}],"html":"\u003ccode class=\"function\"\u003eget_bit\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ebits\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ebit\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003einteger\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"get_bit ( bits bit, n integer ) → integer","zh_from":""}}],"Spellings":null,"SQLState":null,"Evidence":null}
