Re: Determining the type of an obkect in plperl

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Determining the type of an obkect in plperl
Дата
Msg-id CAKFQuwYmB+MbT8KzP4heuis2LavYBVeJ0G_PMampvqv2jexweA@mail.gmail.com
обсуждение исходный текст
Ответ на Determining the type of an obkect in plperl  (stan <stanb@panix.com>)
Ответы Re: Determining the type of an obkect in plperl
Список pgsql-general
On Wed, Mar 4, 2020 at 4:21 PM stan <stanb@panix.com> wrote:
Probably a bit off topic, but I suspect someone on this list knows how to do
this.

I am in the process of writing a plperl function. In this function I need
to compare the data in the NEW versus OLD structures. I am writing this as a
generic subroutine, so I am looping through and comparing the 2 to see what
is different. Problem is, that I need to know whether to us n != or a ne
comparison.

how can I determine what the data type of the value element is?

Not up to speed on Perl but you basically want everything to be done using string equality - can't you just use "ne" everywhere and not worry about comparing numbers using string comparison logic?  Might want to disabled warnings...

That would have to be faster than executing a type_of function on every single column.

Then measure performance and decide whether a generic routine is performant enough.  If not you might try creating custom function dynamically using the catalogs as input.

David J.

В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Advice request : simultaneous function/data updates on many databases
Следующее
От: Rory Campbell-Lange
Дата:
Сообщение: Re: Advice request : simultaneous function/data updates on manydatabases