Re: [GENERAL] About the MONEY type

2016-11-30 Thread Tobia Conforto
>> I think MONEY is a great datatype, at least in theory. > > I personally find it pretty useless to be honest - especially because > the currency symbol depends on the client. I should have been more clear: I find the underlying idea of storing a fixed-scale decimal number as a pre-scaled int8 co

[GENERAL] About the MONEY type

2016-11-30 Thread Tobia Conforto
I think MONEY is a great datatype, at least in theory. It's stored as a 64 bit binary integer with an implied, fixed decimal scale. This means that storage is conserved and operations are as fast and exact as possible (to the implied decimal scale.) Unfortunately it has a couple of significant dr

[GENERAL] Creating or modifying a tsquery from PL/pgSQL

2016-06-17 Thread Tobia Conforto
I'd like to convert a plain search string into a tsquery, much like plainto_tsquery(), but enabling prefix searches (:*) for every word. I've come up with this: select regexp_replace( plainto_tsquery('english', 'text to search')::text, '''(?= |$)', ''':*', 'g' )::tsq

Re: [GENERAL] Multi-row constraints, how to avoid unnecessary trigger execution?

2016-04-06 Thread Tobia Conforto
Sándor, I'd rather have the application developers use regular DML, which could become quite complex, and just perform my check on the database side, at transaction commit time. Andreas, thanks, but I need to avoid duplicate executions on different rows too. I just came up with this "hack" whic

[GENERAL] Multi-row constraints, how to avoid unnecessary trigger execution?

2016-04-06 Thread Tobia Conforto
I have a complex data validation requirement that spans many rows and possibly more than one table. The application must be able to perform several data manipulation statements that could invalidate the requirement between one another, and only have the database check this requirement at transa

Re: [GENERAL] Exclude constraint using custom operator

2016-04-06 Thread Tobia Conforto
implemented in C and header files. -Tobia > On 5 Apr 2016, at 19:30, Tobia Conforto wrote: > > Hello > > I'd like to use the Nested Set model[1] to represent a hierarchical data > structure in PostgreSQL. I'm considering using a single int4range column > instead o

[GENERAL] Exclude constraint using custom operator

2016-04-05 Thread Tobia Conforto
Hello I'd like to use the Nested Set model[1] to represent a hierarchical data structure in PostgreSQL. I'm considering using a single int4range column instead of the traditional two columns (lft and rgt) because the two values do in fact represent a range of integers. This should allow me to a