Обсуждение: Override PostgreSQL internal functions
Best Regards,
Sameer Kumar | Database Consultant
ASHNIK PTE. LTD.
101 Cecil Street, #11-11 Tong Eng Building, Singapore 069533
M: +65 8110 0350 T: +65 6438 3504 | www.ashnik.com
This email may contain confidential, privileged or copyright material and is solely for the use of the intended recipient(s).
Вложения
Is there a way I can override (not overload) PostgreSQL internal functions e.g. replace()?By default replace() will replace string based on case sensitivity. I want to override this behavior and make it case insensitive.
You would be much better off to use the citext extension and typing your columns appropriately.
http://www.postgresql.org/docs/current/static/citext.html
-- Vik
You would be much better off to use the citext extension and typing your columns appropriately.
http://www.postgresql.org/docs/current/static/citext.html
Best Regards,
Sameer Kumar | Database Consultant
ASHNIK PTE. LTD.
101 Cecil Street, #11-11 Tong Eng Building, Singapore 069533
M: +65 8110 0350 T: +65 6438 3504 | www.ashnik.com
This email may contain confidential, privileged or copyright material and is solely for the use of the intended recipient(s).
Вложения
Sameer Kumar wrote > Hi, > > Is there a way I can override (not overload) PostgreSQL internal functions > e.g. replace()? > > By default replace() will replace string based on case sensitivity. I want > to override this behavior and make it case insensitive. For Operators I > can > do that easily as: Basic idea: Create a schema called " overrides " Put your function in " overrides " Make sure the search path includes " overrides " before " pg_catalog " This way lookup will always resolve to your function before it resolves to the system supplied function. David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Override-PostgreSQL-internal-functions-tp5793670p5793703.html Sent from the PostgreSQL - novice mailing list archive at Nabble.com.
Thanks!
I think that should work well. Don't know why it never occured to me.
Regards
Sameer
PS: Sent from my Mobile device. Pls ignore typo n abb
On Wed, Feb 26, 2014 at 6:54 PM, Vik Fearing <vik.fearing@dalibo.com> wrote:You would be much better off to use the citext extension and typing your columns appropriately.
http://www.postgresql.org/docs/current/static/citext.htmlThat might be a huge effort while migrating from another database and might also introduce application level changes for type casting.
Not nearly as much effort as what you're trying to do, but good luck.
David's solution is what I would have suggested had he not said it already.
-- Vik
Not nearly as much effort as what you're trying to do, but good luck.
David's solution is what I would have suggested had he not said it already.
Best Regards,
Sameer Kumar | Database Consultant
ASHNIK PTE. LTD.
101 Cecil Street, #11-11 Tong Eng Building, Singapore 069533
M: +65 8110 0350 T: +65 6438 3504 | www.ashnik.com
This email may contain confidential, privileged or copyright material and is solely for the use of the intended recipient(s).
Вложения
On 27 February 2014 01:42, Vik Fearing <vik.fearing@dalibo.com> wrote: > On 02/26/2014 03:03 PM, Sameer Kumar wrote: > > > On Wed, Feb 26, 2014 at 6:54 PM, Vik Fearing <vik.fearing@dalibo.com> wrote: >> >> You would be much better off to use the citext extension and typing your >> columns appropriately. >> >> http://www.postgresql.org/docs/current/static/citext.html > > > That might be a huge effort while migrating from another database and might > also introduce application level changes for type casting. > > > Not nearly as much effort as what you're trying to do, but good luck. > > David's solution is what I would have suggested had he not said it already. David's solution seems to be the right solution for general schema override. Vik's comments about using citext seem good for the specific case mentioned. Using citext has all the same issues as overriding existing operators, so its better to use something that works than something home-grown. -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services