Dynamic collation support - Mailing list pgsql-general

From Merlin Moncure
Subject Dynamic collation support
Date
Msg-id CAHyXU0y16yvSR+Gg3BN--vFpxaE8as=2XNLF24291hsO4acx6w@mail.gmail.com
Whole thread Raw
Responses Re: Dynamic collation support  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-general
For database functions, is there any way to manage collations besides
dynamic sql?  It doesn't look like there is but I thought I'd ask.

For example, I want to do something like:

DO
$$
DECLARE
  c name DEFAULT 'en_GB';
BEGIN
  SELECT * FROM foo ORDER BY a COLLATE c;
END;
$$;

and not

DO
$$
DECLARE
  c name DEFAULT 'en_GB';
BEGIN
  EXECUTE 'SELECT * FROM foo ORDER BY a COLLATE ' || quote_ident(c);
END;
$$;

I understand this would disable all index supported sorting; that's ok.

Not being able to specify collation in a parameterized manner presents
some issues...I'm curious if there are workarounds.

merlin


pgsql-general by date:

Previous
From: DerekW
Date:
Subject: Re: Error installing 9.5 on Win 2012 R2: data dir not created
Next
From: Pavel Stehule
Date:
Subject: Re: Dynamic collation support