Re: Set COLLATE on a session level

2020-12-11 Thread Alexandre GRAIL
On 10/12/2020 19:33, Dirk Mika wrote: There is a SET COLLATION command in the SQL standard that does this. Someone just has to implement it. It wouldn't be terribly difficult, I think. I think it would be analogous to the schema search path. Usually you notice right away if the "search_path"

Re: Set COLLATE on a session level

2020-12-11 Thread Peter J. Holzer
On 2020-11-30 10:11:38 +, Dirk Mika wrote: > > > pá 20. 11. 2020 v 15:28 odesílatel Dirk Mika > > > napsal: > > > > Let's assume there is an app that accesses the same database from > > > > different countries. And in this app data should be displayed ordered. > > > > And > > > > the sort ord

Re: Set COLLATE on a session level

2020-12-10 Thread Dirk Mika
-- Dirk Mika Software Developer mika:timing GmbH Strundepark - Kürtener Str. 11b 51465 Bergisch Gladbach Germany fon +49 2202 2401-1197 dirk.m...@mikatiming.de www.mikatiming.de AG Köln HRB 47509 * WEEE-Reg.-Nr. DE 90029884 Geschäftsführer: Harald Mika, Jörg Mika Am 06.12.20, 06:15 schrieb

Re: Set COLLATE on a session level

2020-12-05 Thread Laurenz Albe
On Sat, 2020-12-05 at 13:12 +0100, Peter Eisentraut wrote: > On 2020-12-04 17:18, Tom Lane wrote: > > > There is a SET COLLATION command in the SQL standard that does this. > > > Someone just has to implement it. It wouldn't be terribly difficult, I > > > think. > > > > [ squint... ] Just becaus

Aw: Re: Set COLLATE on a session level

2020-12-05 Thread Karsten Hilbert
> There's [...] but few differences across linguistic sorts. > These differences tend to be subtle and ignorable by end users. But _when_ they matter they matter a lot: Lists of peoples' names in some not-quite expected order are a major pain to skim over, for example. OP is in the business of t

Aw: Re: Set COLLATE on a session level

2020-12-05 Thread Karsten Hilbert
> > Or a "smart" view. Set a session variable before running the > > query and have the (one) view return the locale'd data based > > on the session variable ... > > > > set session "mika.current_locale" = 'locale@2_use'; > > > > and use > > > > select current_setting('mika.current_

Re: Set COLLATE on a session level

2020-12-05 Thread Peter Eisentraut
On 2020-12-04 17:18, Tom Lane wrote: There is a SET COLLATION command in the SQL standard that does this. Someone just has to implement it. It wouldn't be terribly difficult, I think. [ squint... ] Just because it's in the standard doesn't mean it's a good idea. It sounds like this is morall

Re: Set COLLATE on a session level

2020-12-04 Thread Tom Lane
Peter Eisentraut writes: > On 2020-11-20 08:13, Dirk Mika wrote: >> I know that I can specify a COLLATE for a SELECT statement in the ORDER BY >> Clause, but then I would have to adjust the statements in the client and >> statements that are automatically generated by the database components use

Re: Set COLLATE on a session level

2020-12-04 Thread Peter Eisentraut
On 2020-11-20 08:13, Dirk Mika wrote: we come from the Oracle world and we have an application that, depending on a setting, sends the command ALTER SESSION SET NLS_SORT=... when connecting to the database. Is there a similar way to set a COLLATE for a session in PostgreSQL? I know that I can

Re: Set COLLATE on a session level

2020-12-03 Thread Dirk Mika
> > > Or views in schemas per locale. Selecting the search path > > > per locale pulls in the right view. > > > > And one view per locale would mean that I would have to > > create a whole schema including all views for each locale I > > want to support. I would have to roll out a new version of >

Re: Set COLLATE on a session level

2020-11-30 Thread Karsten Hilbert
Am Mon, Nov 30, 2020 at 10:11:38AM + schrieb Dirk Mika: > > Or views in schemas per locale. Selecting the search path > > per locale pulls in the right view. > > And one view per locale would mean that I would have to > create a whole schema including all views for each locale I > want to supp

Re: Set COLLATE on a session level

2020-11-30 Thread Dirk Mika
> > pá 20. 11. 2020 v 15:28 odesílatel Dirk Mika > > napsal: > > > > > Let's assume there is an app that accesses the same database from > > > different countries. And in this app data should be displayed ordered. And > > > the sort order is not identical in all countries. > > > > > > Does the ap

Re: Set COLLATE on a session level

2020-11-20 Thread Karsten Hilbert
On Fri, Nov 20, 2020 at 03:32:48PM +0100, Pavel Stehule wrote: > pá 20. 11. 2020 v 15:28 odesílatel Dirk Mika > napsal: > > > Let's assume there is an app that accesses the same database from > > different countries. And in this app data should be displayed ordered. And > > the sort order is not

Re: Set COLLATE on a session level

2020-11-20 Thread Pavel Stehule
Hi pá 20. 11. 2020 v 15:28 odesílatel Dirk Mika napsal: > Thank you for the quick reply. But how is this usually solved? > > Let's assume there is an app that accesses the same database from > different countries. And in this app data should be displayed ordered. And > the sort order is not iden

Re: Set COLLATE on a session level

2020-11-20 Thread Dirk Mika
Thank you for the quick reply. But how is this usually solved? Let's assume there is an app that accesses the same database from different countries. And in this app data should be displayed ordered. And the sort order is not identical in all countries. Does the app have to send different SQL c

Re: Set COLLATE on a session level

2020-11-20 Thread Laurenz Albe
On Fri, 2020-11-20 at 07:13 +, Dirk Mika wrote: > we come from the Oracle world and we have an application that, depending on a > setting, > sends the command ALTER SESSION SET NLS_SORT=... when connecting to the > database. > > Is there a similar way to set a COLLATE for a session in Postg

Set COLLATE on a session level

2020-11-19 Thread Dirk Mika
Hello, we come from the Oracle world and we have an application that, depending on a setting, sends the command ALTER SESSION SET NLS_SORT=... when connecting to the database. Is there a similar way to set a COLLATE for a session in PostgreSQL? I know that I can specify a COLLATE for a SELECT