DPY-3040 on AR8MSWIN1256 (charset id 560) when reading DbObject string attributes in Thin mode
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 57/100
調査の方向性
Start with src/oracledb/impl/thin/capabilities.pyx, where the issue says ORACLE_CHARSET_TO_PYTHON_ENCODING maps cp1256 to charset id 175, while the database reports id 560. Check the neighboring Windows code-page mappings (172–177) and reproduce with the provided DbObject OUT-bind example on a database using AR8MSWIN1256. Done when reading the string attribute succeeds in Thin mode and the neighboring mappings are checked for the reported mismatches.
索引モデルが issue の本文から書いたものです。
説明
- What versions are you using?
Oracle Database: 19.31.0.0.0
Database character set: AR8MSWIN1256 (SELECT NLS_CHARSET_ID('AR8MSWIN1256') FROM dual returns 560)
platform.platform: Windows-2022Server-10.0.20348-SP0
sys.maxsize > 2**32: True
platform.python_version: 3.12.13
oracledb.__version__: 4.0.2
- Is it an error or a hang or a crash?
An error.
- What error(s) or behavior you are seeing?
Ordinary query columns work fine on this database, because the server converts them. Reading a VARCHAR2 attribute of a DbObject (here an element of a nested-table OUT bind) fails:
File "...\oracledb\dbobject.py", line 46, in __getattr__
return self._impl.get_attr_value(attr_impl)
File "src/oracledb/impl/thin/dbobject.pyx", line 483, in oracledb.thin_impl.ThinDbObjectImpl.get_attr_value
File "src/oracledb/impl/thin/dbobject.pyx", line 198, in oracledb.thin_impl.ThinDbObjectImpl._ensure_unpacked
File "src/oracledb/impl/thin/dbobject.pyx", line 316, in oracledb.thin_impl.ThinDbObjectImpl._unpack_data
File "src/oracledb/impl/thin/dbobject.pyx", line 349, in oracledb.thin_impl.ThinDbObjectImpl._unpack_data_from_buf
File "src/oracledb/impl/thin/dbobject.pyx", line 406, in oracledb.thin_impl.ThinDbObjectImpl._unpack_value
File "src/oracledb/impl/thin/capabilities.pyx", line 164, in oracledb.thin_impl.Capabilities._get_encoding
File "...\oracledb\errors.py", line 199, in _raise_err
raise error.exc_type(error) from cause
oracledb.exceptions.NotSupportedError: DPY-3040: database character set id 560 is not supported by python-oracledb in thin mode
In src/oracledb/impl/thin/capabilities.pyx, ORACLE_CHARSET_TO_PYTHON_ENCODING maps cp1256 (AR8MSWIN1256) to id 175, but the database reports AR8MSWIN1256 as id 560. So the lookup misses even though the encoding is meant to be supported. The neighbouring Windows code-page entries (172–177) may also be worth checking. On our database:
SELECT cs, NLS_CHARSET_ID(cs) AS id
FROM (SELECT COLUMN_VALUE cs
FROM TABLE(sys.odcivarchar2list('EL8MSWIN1253', 'TR8MSWIN1254', 'IW8MSWIN1255',
'AR8MSWIN1256', 'BLT8MSWIN1257', 'VN8MSWIN1258')));
"CS" "ID"
"EL8MSWIN1253" 174
"TR8MSWIN1254" 177
"IW8MSWIN1255" 175
"AR8MSWIN1256" 560
"BLT8MSWIN1257" 179
"VN8MSWIN1258" 45
Workaround: return the collection as a REF CURSOR over TABLE(...) instead of binding it as an object, so the server does the conversion.
- Does your application call init_oracle_client()?
No, it uses Thin mode.
- Include a runnable Python script that shows the problem.
Needs a database whose character set is AR8MSWIN1256.
CREATE OR REPLACE TYPE dpy3040_t AS OBJECT (id NUMBER, name VARCHAR2(50));
/
CREATE OR REPLACE TYPE dpy3040_tab AS TABLE OF dpy3040_t;
/
import oracledb
conn = oracledb.connect(user="<user>", password="<password>", dsn="<dsn>")
print("db version:", conn.version)
tab_type = conn.gettype("DPY3040_TAB")
with conn.cursor() as cur:
out = cur.var(tab_type)
cur.execute("""
BEGIN
:out := dpy3040_tab(dpy3040_t(1, 'abc'));
END;""", out=out)
element = out.getvalue().aslist()[0]
print(element.ID) # works: NUMBER needs no character set
print(element.NAME) # DPY-3040: database character set id 560 is not supported
- 主要言語
- Python
- スター
- 458
- フォーク
- 123
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
oracle/python-oracledb のほかの issue
-
Thin mode: an outputtypehandler redefining a CLOB as DB_TYPE_LONG misreads the reply when the statement is cached再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
oracle/python-oracledb#634 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
oracle/python-oracledb#633 ·
-
Thin mode: segfault when a cached query is executed again after its first execute failed with ORA-01438対応中かも @jhchong0405 が 3 日前に担当しました。 オープン
難易度 4/5 1〜2日 初心者へのやさしさ 38/100
oracle/python-oracledb#631 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
oracle/python-oracledb#630 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
oracle/python-oracledb#629 ·
oracle/python-oracledb の issue をすべて見る
似ている issue
-
SslLibrary crashes with unhandled OSError: port/proto not found on non-standard SSL ports対応中かも @himanchalkaushale が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
OWASP/Nettacker#1884 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
A-connection-core C-enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
aws-samples/sample-per-model-bedrock#869 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
fzn0x/watchtower#17 ·