Skip to content

Commit

Permalink
Added more content for NLS config file as per the review comments fro…
Browse files Browse the repository at this point in the history
…m Nishant
  • Loading branch information
nidhibhammar committed Aug 27, 2024
1 parent bb7fb5e commit 7b46adc
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ EDB Postgres Advanced Server version 17 and later provides the support for NLS f

## NLS config file

The `edb_redwood_nls.config` file maintains the list of NLS parameters mapping with an equivalent collation. The NLS parameters and an equivalent collation are listed in each row in the config file separated by commas respectively. The config file contains a default list of NLS parameters and an equivalent collation pairs.
The `edb_redwood_nls.config` file maintains the list of NLS parameters mapping with an equivalent collation. The NLS parameters and an equivalent collation are listed in each row in the config file separated by commas respectively. The config file contains a default list of NLS parameters and an equivalent collation pairs. By default the file is located at `EPAS_INSTALLATION_DIRECTORY/share/postgresql/contrib/`.

<details><summary>The default NLS config file contents:</summary>
ARABIC,"pg_catalog"."default"<br/>
Expand Down Expand Up @@ -104,12 +104,16 @@ The config file can contain multiple mappings for a single NLS parameter. You ca

You can add a new mapping in the NLS config file,
- by manually editing the config file in the format `NLS_parameter,<schema_name>.<collation>`.
- or by using the `edb_nls_cf_insert` function.
- or by using the `edb_nls_cf_insert` function. When using `edb_nls_cf_insert` function it's crucial to ensure that the file has the correct write permissions. Without the appropriate permissions, attempts to modify the file will fail, potentially leading to errors or incomplete configurations.

where `<schema_name>.<collation>` is to be obtained from `pg_collation` catalog and mapped to a valid NLS parameter.
where `<schema_name>.<collation>` is to be obtained from `pg_collation` catalog and mapped to a valid NLS parameter. Only the collations with an encoding of `-1` (which represents "any encoding") or the database encoding are allowed.

Add this mapping before using the NLS parameter in the NLS functions.

If you're encountering NOTICE messages due to invalid entries in the NLS config file, the best approach is to manually remove those invalid entries. These messages typically occur when the database is trying to reference locales or collations that no longer exist or are incorrectly specified in the configuration file.

It's important to recognize that collation values are platform-dependent, meaning a collation available on one platform might not be present on another. To avoid compatibility issues, always use collations that are available in the `pg_collation` table within your environment.

**Usage of NLS config file**

- Each client session reads the config file and stores the NLS parameters and collation values in in-mem HASH data structure when any of the NLS function is called for the first time.
Expand Down

0 comments on commit 7b46adc

Please sign in to comment.