Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

valid_default_lang error occurring for gtfs feeds. #32

Open
rahulkgupta opened this issue Dec 28, 2022 · 2 comments
Open

valid_default_lang error occurring for gtfs feeds. #32

rahulkgupta opened this issue Dec 28, 2022 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@rahulkgupta
Copy link

ERROR: new row for relation "feed_info" violates check constraint "valid_default_lang"

Was fixed by changing feed_lang from en to en_US.utf8 but en seems to be used in the example amtrak GTFS and in BART.

@derhuerst derhuerst added bug Something isn't working help wanted Extra attention is needed labels Dec 29, 2022
@derhuerst
Copy link
Member

AFAICT, en is a valid BCP 47 language tag, so it should not cause gtfs-via-postgres to fail.

This is the current implementation of the validation:

-- Unfortunately information_schema.collations.collation_name only has
-- identifiers with "_", not with "-", so we use pg_collation instead.
-- https://www.postgresql.org/docs/current/infoschema-collations.html
-- https://www.postgresql.org/docs/current/catalog-pg-collation.html
CREATE OR REPLACE FUNCTION "${opt.schema}".is_bcp_47_code(
input TEXT
)
RETURNS BOOLEAN
AS $$
SELECT EXISTS (
SELECT collctype
FROM pg_collation
WHERE collctype = input
OR collname = input
OR collname = input || '-x-icu'
LIMIT 1
);
$$ language sql STABLE;

I'm not that familiar though, with the details of how PostgreSQL handles localisation, so I don't know how to implement this properly.

@1Maxnet1
Copy link
Contributor

1Maxnet1 commented Feb 9, 2023

FYI: I also got the same error. For me it was fixed with replacing "DE" by "de".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Development

No branches or pull requests

3 participants