--- warning: DO NOT CHANGE THIS MANUALLY, THIS IS GENERATED BY https://github.com/duckdb/community-extensions repository, check README there title: ng_postcode excerpt: | DuckDB Community Extensions Parse, validate, format, and group Nigeria's NIPOST digital postcode (NDAPS) extension: name: ng_postcode description: Parse, validate, format, and group Nigeria's NIPOST digital postcode (NDAPS) version: 0.2.0 language: Rust build: cargo license: MIT excluded_platforms: "wasm_mvp;wasm_eh;wasm_threads;windows_amd64_rtools;windows_amd64_mingw;linux_amd64_musl" requires_toolchains: "rust;python3" maintainers: - Adeniyikayodee repo: github: Adeniyikayodee/ng-postcode-duckdb ref: a584158edc26f40554ee5fb8a3290ff3eca1c90a docs: hello_world: | SELECT ng_postcode_parse('ek 01 a03 fk 01') AS code, ng_postcode_format(ng_postcode_truncate('ek 01 a03 fk 01', 'district')) AS district; extended_description: | Nigeria's digital postcode has eleven letters and digits in five segments: state, local government area, district, area, and unit. It is written `EK-01-A03-FK-01` and stored as `EK01A03FK01`. This extension reads the code offline, with no network call and no lookup table. A value that is not a well-formed code gives NULL. - `ng_postcode_parse(text)` returns the compact form of a complete code. - `ng_postcode_prefix_parse(text)` accepts a code cut off after any segment. - `ng_postcode_format(text)` returns the hyphenated form. - `ng_postcode_truncate(text, segment)` cuts a code after `state`, `lga`, `district`, `area`, or `unit`. - `ng_postcode_parent(text)` returns the next coarser prefix. - `ng_postcode_within(text, prefix)` tells whether a code lies inside a prefix. - `ng_postcode_compact(text)` strips spaces and hyphens and uppercases. - `ng_postcode_version()` returns the extension version. Counting rows by district needs no map: ```sql SELECT ng_postcode_format(ng_postcode_truncate(postcode, 'district')) AS district, count(*) FROM deliveries GROUP BY 1 ORDER BY 2 DESC; ``` The functions pass the shared test cases of the [ng-postcode](https://github.com/Adeniyikayodee/ng-postcode) libraries for Rust, Python, JavaScript, and Java. The source is at https://github.com/Adeniyikayodee/ng-postcode-duckdb. extension_star_count: 0 extension_star_count_pretty: 0 extension_download_count: 855 extension_download_count_pretty: 855 image: '/images/community_extensions/social_preview/preview_community_extension_ng_postcode.png' layout: community_extension_doc --- ### Compatibility Matrix This table covers all DuckDB releases that have not reached [end-of-life](https://duckdb.org/release_calendar), including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 | | :--- | :---: | :---: | :---: | :---: | :---: | | Linux AMD64 | ❌ | ❌ | ❌ | ✅ | ✅ | | Linux ARM64 | ❌ | ❌ | ❌ | ✅ | ✅ | | macOS AMD64 | ❌ | ❌ | ❌ | ✅ | ✅ | | macOS ARM64 | ❌ | ❌ | ❌ | ✅ | ✅ | | Windows AMD64 | ❌ | ❌ | ❌ | ✅ | ✅ | | Windows ARM64 | ❌ | ❌ | ❌ | ❌ | ❌ | | WebAssembly | ❌ | ❌ | ❌ | ❌ | ❌ | ### Installing and Loading ```sql INSTALL {{ page.extension.name }} FROM community; LOAD {{ page.extension.name }}; ``` {% if page.docs.hello_world %} ### Example ```sql {{ page.docs.hello_world }}``` {% endif %} {% if page.docs.extended_description %} ### About {{ page.extension.name }} {{ page.docs.extended_description }} {% endif %} ### Added Functions
| function_name | function_type | description | comment | examples | |--------------------------|---------------|------------------------------------------------------------------------------------------------------------------|--------------------------------------------------|--------------------------------------------------------------------------| | ng_postcode_parse | scalar | Parse a Nigerian NIPOST postcode in any case or spacing into its 11-character compact form, or NULL if malformed | Returns VARCHAR. Rejects the old six-digit code. | [SELECT ng_postcode_parse('ek 01 a03 fk 01'); -- EK01A03FK01] | | ng_postcode_prefix_parse | scalar | Parse a postcode cut off after any segment into its compact prefix, or NULL | Returns VARCHAR. | [SELECT ng_postcode_prefix_parse('ek-01-a03'); -- EK01A03] | | ng_postcode_format | scalar | Format a code or prefix in the hyphenated style, or NULL if malformed | Returns VARCHAR. | [SELECT ng_postcode_format('EK01A03FK01'); -- EK-01-A03-FK-01] | | ng_postcode_truncate | scalar | Cut a code after a segment: state, lga, district, area or unit | Returns VARCHAR. NULL for an unknown segment. | [SELECT ng_postcode_truncate('EK-01-A03-FK-01', 'district'); -- EK01A03] | | ng_postcode_parent | scalar | Return the next coarser prefix of a code or prefix | Returns VARCHAR. | [SELECT ng_postcode_parent('EK01A03FK01'); -- EK01A03FK] | | ng_postcode_within | scalar | Whether a code lies inside a prefix | Returns BOOLEAN. | [SELECT ng_postcode_within('EK-01-A03-FK-01', 'EK-01'); -- true] | | ng_postcode_compact | scalar | Strip spaces and hyphens and uppercase, without validating | Returns VARCHAR. | [SELECT ng_postcode_compact(' ek-01 a03 fk 01 '); -- EK01A03FK01] | | ng_postcode_version | scalar | The extension version | Returns VARCHAR. | [SELECT ng_postcode_version();] | ### Overloaded Functions
This extension does not add any function overloads. ### Added Types
This extension does not add any types. ### Added Settings
| name | description | input_type | scope | aliases | typed_value | |----------------|---------------------------------------------------------|------------|--------|---------|-------------| | temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |