From d891b25dfb5f2c33cdbd517f872437d6bbf377ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B3=BD=E6=B5=A9?= <266632325+Loyal-Young@users.noreply.github.com> Date: Tue, 24 Nov 2026 01:02:17 +0800 Subject: [PATCH] docs: explain when datetime input uses NLS formats Fixes #469. Assisted-by: Codex:GPT-6 Percentage of AI-generated code: 100% --- CN/modules/ROOT/pages/6.3.5.adoc | 16 +++++++++++++++- EN/modules/ROOT/pages/6.3.5.adoc | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/CN/modules/ROOT/pages/6.3.5.adoc b/CN/modules/ROOT/pages/6.3.5.adoc index 0f4fe93b..9b4c955d 100644 --- a/CN/modules/ROOT/pages/6.3.5.adoc +++ b/CN/modules/ROOT/pages/6.3.5.adoc @@ -127,7 +127,21 @@ oratimestampltz_in() oratimestamptz_in() ``` -如果相应的掩码被设置,则调用原生PG的处理函数,否则调用兼容代码并忽略NLS格式。 +对应位为 1 时,该类型使用原生 PostgreSQL 输入解析;对应位为 0 时,兼容输入函数使用该类型配置的 NLS 格式解析。默认掩码为 `0`,因此四种类型最初都使用各自的 NLS 输入格式。将相应格式字符串设为 `pg` 也会选择原生 PostgreSQL 解析。 + +下面的 `oradate` 示例先使用 `nls_date_format`,再将位 `1` 设为 1,使用原生 PostgreSQL 输入格式。两次查询均返回 `2026-01-31`。 + +[source,sql] +---- +BEGIN; +SET ivorysql.datetime_ignore_nls_mask = 0; +SET nls_date_format = 'DD/MM/YYYY'; +SELECT TO_CHAR('31/01/2026'::sys.oradate, 'YYYY-MM-DD'); + +SET ivorysql.datetime_ignore_nls_mask = 1; +SELECT TO_CHAR('2026-01-31'::sys.oradate, 'YYYY-MM-DD'); +ROLLBACK; +---- === GUC参数 `nls_date_format`/`nls_timestamp_format`/`nls_timestamp_tz_format` diff --git a/EN/modules/ROOT/pages/6.3.5.adoc b/EN/modules/ROOT/pages/6.3.5.adoc index 868fae69..292b81c0 100644 --- a/EN/modules/ROOT/pages/6.3.5.adoc +++ b/EN/modules/ROOT/pages/6.3.5.adoc @@ -122,7 +122,21 @@ oratimestampltz_in() oratimestamptz_in() ``` -If the corresponding mask is set, the native PostgreSQL processing function is called; otherwise, the compatibility code is invoked, and NLS formats are ignored. +A set bit selects native PostgreSQL input parsing for that type. With the bit clear, the compatibility input function parses using the type's configured NLS format. The default mask is `0`, so all four types initially use their NLS input formats. Setting the relevant format string to `pg` also selects native PostgreSQL parsing. + +For `oradate`, this example first uses `nls_date_format`, then sets bit `1` to accept native PostgreSQL input. Both queries return `2026-01-31`. + +[source,sql] +---- +BEGIN; +SET ivorysql.datetime_ignore_nls_mask = 0; +SET nls_date_format = 'DD/MM/YYYY'; +SELECT TO_CHAR('31/01/2026'::sys.oradate, 'YYYY-MM-DD'); + +SET ivorysql.datetime_ignore_nls_mask = 1; +SELECT TO_CHAR('2026-01-31'::sys.oradate, 'YYYY-MM-DD'); +ROLLBACK; +---- === GUC Parameters `nls_date_format`/`nls_timestamp_format`/`nls_timestamp_tz_format`