Mark vatin type as collatable

Otherwise, since it is a type based on text, users could receive an
error like

> ERROR: could not determine which collation to use for string comparison

when running VACUUM ANALYZE, for instance.
This commit is contained in:
jordi fita mas 2023-07-03 17:46:18 +02:00
parent 6db136f578
commit 0bbb04196f
4 changed files with 25 additions and 3 deletions

View File

@ -2,7 +2,8 @@ MODULE_big = vat
OBJS = vatin.o es.o
EXTENSION = vat
DATA = vat--0.0.sql
DATA = vat--0.0.sql \
vat--0.0--0.1.sql
PGFILEDESC = "vat - data type for VAT identification numbers"
REGRESS = vat

8
debian/changelog vendored
View File

@ -1,4 +1,10 @@
vat (0.2-3) bookworm; urgency=medium
vat (0.3-1) bookworm; urgency=medium
* Mark the type as collatable.
-- jordi fita mas <jordi@tandem.blog> Mon, 03 Jul 2023 17:44:51 +0002
vat (0.2-1) bookworm; urgency=medium
* Fix CIF computation for CIF ending with 0.

15
vat--0.0--0.1.sql Normal file
View File

@ -0,0 +1,15 @@
/*
* SPDX-FileCopyrightText: 2023 jordi fita mas <jfita@peritasoft.com>
*
* SPDX-License-Identifier: PostgreSQL
*/
-- complain if script is sources in psql, rather than via CREATE EXTENSION
\echo Use "ALTER EXTENSION vat UPDATE TO '0.1'" to load this file. \quit
-- mark the type as collatable
UPDATE pg_catalog.pg_type SET typcollation = 100
WHERE oid = 'vatin'::pg_catalog.regtype;
UPDATE pg_catalog.pg_attribute SET attcollation = 100
WHERE atttypid = 'vatin'::pg_catalog.regtype;

View File

@ -1,5 +1,5 @@
comment = 'data type for VAT registration numbers'
default_version = '0.0'
default_version = '0.1'
module_pathname = '$libdir/vat'
relocatable = true
superuser = false