pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #11761: range_in dosn't work via direct functional call
3+ messages / 3 participants
[nested] [flat]

* BUG #11761: range_in dosn't work via direct functional call
@ 2014-10-22 17:27  olegjobs@mail.ru
  0 siblings, 1 reply; 3+ messages in thread

From: olegjobs@mail.ru @ 2014-10-22 17:27 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      11761
Logged by:          Oleg
Email address:      olegjobs@mail.ru
PostgreSQL version: 9.3.2
Operating system:   Ubuntu 64 14.04
Description:        

This function test_ext_get_range(cstring) returns int4range:

Datum test_ext_get_range(PG_FUNCTION_ARGS)
{
   char *ts = PG_GETARG_CSTRING(0);
   
   return DirectFunctionCall3(range_in, CStringGetDatum(ts),
ObjectIdGetDatum(3904), Int32GetDatum(0);
}
In psql:
select test_ext_get_range('[1,1]');
error:
connection to the server was lost.

it seems to me that some memory problems because of "The range I/O functions
need a bit more cached info than other range
 * functions, so they store a RangeIOData struct in fn_extra, not just a
 * pointer to a type cache entry. "  



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #11761: range_in dosn't work via direct functional call
@ 2014-10-24 13:08  Heikki Linnakangas <hlinnakangas@vmware.com>
  parent: olegjobs@mail.ru
  0 siblings, 1 reply; 3+ messages in thread

From: Heikki Linnakangas @ 2014-10-24 13:08 UTC (permalink / raw)
  To: olegjobs@mail.ru; pgsql-bugs

On 10/22/2014 08:27 PM, olegjobs@mail.ru wrote:
> This function test_ext_get_range(cstring) returns int4range:
>
> Datum test_ext_get_range(PG_FUNCTION_ARGS)
> {
>     char *ts = PG_GETARG_CSTRING(0);
>
>     return DirectFunctionCall3(range_in, CStringGetDatum(ts),
> ObjectIdGetDatum(3904), Int32GetDatum(0);
> }
> In psql:
> select test_ext_get_range('[1,1]');
> error:
> connection to the server was lost.
>
> it seems to me that some memory problems because of "The range I/O functions
> need a bit more cached info than other range
>   * functions, so they store a RangeIOData struct in fn_extra, not just a
>   * pointer to a type cache entry. "

Yeah, DirectFunctionCall cannot be used with range_in. Use FunctionCall3 
instead. See this comment in fmgr.c, above DirectFunctionCall1Coll:

> /*
>  * These are for invocation of a specifically named function with a
>  * directly-computed parameter list.  Note that neither arguments nor result
>  * are allowed to be NULL.  Also, the function cannot be one that needs to
>  * look at FmgrInfo, since there won't be any.
>  */

range_in needs to look at FmgrInfo.

- Heikki


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #11761: range_in dosn't work via direct functional call
@ 2014-10-24 13:52  Pavel Stehule <pavel.stehule@gmail.com>
  parent: Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Pavel Stehule @ 2014-10-24 13:52 UTC (permalink / raw)
  To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: olegjobs@mail.ru; pgsql-bugs

2014-10-24 15:08 GMT+02:00 Heikki Linnakangas <hlinnakangas@vmware.com>:

> On 10/22/2014 08:27 PM, olegjobs@mail.ru wrote:
>
>> This function test_ext_get_range(cstring) returns int4range:
>>
>> Datum test_ext_get_range(PG_FUNCTION_ARGS)
>> {
>>     char *ts = PG_GETARG_CSTRING(0);
>>
>>     return DirectFunctionCall3(range_in, CStringGetDatum(ts),
>> ObjectIdGetDatum(3904), Int32GetDatum(0);
>> }
>> In psql:
>> select test_ext_get_range('[1,1]');
>> error:
>> connection to the server was lost.
>>
>> it seems to me that some memory problems because of "The range I/O
>> functions
>> need a bit more cached info than other range
>>   * functions, so they store a RangeIOData struct in fn_extra, not just a
>>   * pointer to a type cache entry. "
>>
>
> Yeah, DirectFunctionCall cannot be used with range_in. Use FunctionCall3
> instead. See this comment in fmgr.c, above DirectFunctionCall1Coll:
>

There is a special "InputFunctionCall"

Regards

Pavel


>
>  /*
>>  * These are for invocation of a specifically named function with a
>>  * directly-computed parameter list.  Note that neither arguments nor
>> result
>>  * are allowed to be NULL.  Also, the function cannot be one that needs to
>>  * look at FmgrInfo, since there won't be any.
>>  */
>>
>
> range_in needs to look at FmgrInfo.
>
> - Heikki
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2014-10-24 13:52 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-10-22 17:27 BUG #11761: range_in dosn't work via direct functional call olegjobs@mail.ru
2014-10-24 13:08 ` Heikki Linnakangas <hlinnakangas@vmware.com>
2014-10-24 13:52   ` Pavel Stehule <pavel.stehule@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox