pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
function in place of sub-select
3+ messages / 2 participants
[nested] [flat]

* function in place of sub-select
@ 2002-10-12 11:52 Bhuvan A <bhuvansql@myrealbox.com>
  2002-10-15 03:47 ` Re: function in place of sub-select Mel Jamero <mel@gmanmi.tv>
  0 siblings, 1 reply; 3+ messages in thread

From: Bhuvan A @ 2002-10-12 11:52 UTC (permalink / raw)
  To: pgsql-admin

Hi,

I am using postgresql 7.2 on RHL7.3.

I know that we cannot return a record or multiple values from a plpgsql
procedure unless otherwise it is a triggered procedure. But i have a need
to use a function in place of sub-select, something like

select * from my_table where field1 in (select my_func());

my_func() returns a value of type text. I am literally parsing the values
in my_func() to return the value, in the format acceptable by IN operator. 
Something like, "'value1', 'value2'". But it has been interpreted as it is 
instead of 'value1' and 'value2' seperately and resulting in 0 record. 
Again, a view instead of function in a sub-select donot help in my case, 
since i have lot of processing involved in the function.

How do i accompanise it in function? Or whats the other way?

TIA.

regards, 
bhuvaneswaran





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

* Re: function in place of sub-select
  2002-10-12 11:52 function in place of sub-select Bhuvan A <bhuvansql@myrealbox.com>
@ 2002-10-15 03:47 ` Mel Jamero <mel@gmanmi.tv>
  2002-10-16 04:43   ` Re: function in place of sub-select Bhuvan A <bhuvansql@myrealbox.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Mel Jamero @ 2002-10-15 03:47 UTC (permalink / raw)
  To: 'Bhuvan A' <bhuvansql@myrealbox.com>; pgsql-admin

Hi Bhuvan!

One way might be to create a C (or C++) program that emulates your my_func
function.

We've tried doing this and did some benchmarks that show that the system
works quite faster when you take out the stored procedures/functions and
"translate" them into C programs.

Regards,

Mel Jamero




-----Original Message-----
From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Bhuvan A
Sent: Saturday, October 12, 2002 7:52 PM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] function in place of sub-select


Hi,

I am using postgresql 7.2 on RHL7.3.

I know that we cannot return a record or multiple values from a plpgsql
procedure unless otherwise it is a triggered procedure. But i have a need
to use a function in place of sub-select, something like

select * from my_table where field1 in (select my_func());

my_func() returns a value of type text. I am literally parsing the values
in my_func() to return the value, in the format acceptable by IN operator.
Something like, "'value1', 'value2'". But it has been interpreted as it is
instead of 'value1' and 'value2' seperately and resulting in 0 record.
Again, a view instead of function in a sub-select donot help in my case,
since i have lot of processing involved in the function.

How do i accompanise it in function? Or whats the other way?

TIA.

regards,
bhuvaneswaran



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org




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

* Re: function in place of sub-select
  2002-10-12 11:52 function in place of sub-select Bhuvan A <bhuvansql@myrealbox.com>
  2002-10-15 03:47 ` Re: function in place of sub-select Mel Jamero <mel@gmanmi.tv>
@ 2002-10-16 04:43   ` Bhuvan A <bhuvansql@myrealbox.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Bhuvan A @ 2002-10-16 04:43 UTC (permalink / raw)
  To: pgsql-admin

> One way might be to create a C (or C++) program that emulates your my_func
> function.
> 
> We've tried doing this and did some benchmarks that show that the system
> works quite faster when you take out the stored procedures/functions and
> "translate" them into C programs.

Rightly said. C functions work faster than the stored procedures. But C
function too wont fit my case. The interpretation, to feed data to the IN
operator cannot be performed properly. How else do we achieve this?

regards,
bhuvaneswaran





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


end of thread, other threads:[~2002-10-16 04:43 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-10-12 11:52 function in place of sub-select Bhuvan A <bhuvansql@myrealbox.com>
2002-10-15 03:47 ` Mel Jamero <mel@gmanmi.tv>
2002-10-16 04:43   ` Bhuvan A <bhuvansql@myrealbox.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