[GENERAL] array_to_records function

2007-09-06 Thread Yudie Pg
Here I'm posting a function to convert array to records. any other suggestions are welcome create or replace function array_to_records(int[]) RETURNS SETOF record AS $$ DECLARE ret_rec record; a int; b int; BEGIN b = length(array_dims($1)); a = substr(array_dims($1),4, (b-4) ); FOR

Re: [GENERAL] Indexes on array columns

2007-01-16 Thread Yudie Pg
I have tried testing the perofmance on indexing array element using standard btree and it doesn't help anything. It still costing alot. create index idx_properties_address_4 on properties ((address_arr[4])) does contrib/intarray effective for text array? On 3/16/06, Oleg Bartunov wrote: co

[GENERAL] tsearch partial word

2006-04-17 Thread Yudie Pg
Is it possible to search partial word as like '%...%' in tsearch?   Yudie

Re: [GENERAL] Running Command Line From Trigger?

2006-04-07 Thread Yudie Pg
Help! Try to install plperl ./createlang plperl mydb   createlang: language installation failed: ERROR:  could not access file "$libdir/plperl": No such file or directory          

Re: [GENERAL] Running Command Line From Trigger?

2006-04-07 Thread Yudie Pg
Back to my original question where is it possible to run a command line from a function?

Re: [GENERAL] Running Command Line From Trigger?

2006-04-07 Thread Yudie Pg
  I'm running postgresql 7.4.1. is it can't really be used for trigger function?   http://www.postgresql.org/docs/7.4/static/plperl-missing.html          

[GENERAL] Running Command Line From Trigger?

2006-04-06 Thread Yudie Pg
I want to execute a command line from trigger function. The reason is I want to execute my perl script from stored procedure.   any idea?     Yudie

[GENERAL] record OID to table

2006-03-03 Thread Yudie Pg
How can I possible to find out what table a record belong to from record's oid?     Thanks Yudie    

Re: [GENERAL] How to join function with a table?

2005-08-08 Thread Yudie Pg
On 8/5/05, Tom Lane <[EMAIL PROTECTED]> wrote: Certainly not --- per the SQL spec, different elements of a FROM listare independent, so the datelist relation can't refer to P. (I think SQL 2003 has a construct called LATERAL that would allowsuch things, but we don't implement that yet.)The only wa

Re: [GENERAL] How to join function with a table?

2005-08-05 Thread Yudie Pg
what about something likeselect id,datelistfrom payment as p,  (select * from datelist('8/1/2005, 8/5/2005')) as list where datelist between p.date_start and p.date_end; That's works but have to put the whole date range into the parameters before it can be joined. This would need 2 queries whe

Re: [GENERAL] How to join function with a table?

2005-08-05 Thread Yudie Pg
 try select * from payment as p, (select * from datelist('8/1/2005, 8/5/2005')) as datewhere date..  =  p.    The problem is the function's parameters '8/1/2005', '8/5/2005' has to refer to whatever value on the payment records.  

[GENERAL] How to join function with a table?

2005-08-05 Thread Yudie Pg
Hi everyone,   I have a function returning set of date called datelist(date,date) example: select * from datelist('8/1/2005, 8/5/2005'); 8/1/2005 8/2/3005 8/3/2004 8/4/2005 8/5/2005   I would like to join this function with a table create table payment(  id int4 not null,  date_start date,  date_e

Re: [GENERAL] hpw to Count without group by

2005-06-02 Thread Yudie Pg
I do not believe you can do this without a subquery - you are tryingto get 2 separate pieces of information from your data   * some data about the record having MAX(rank) for each categoryand  * the count of records in each category   Hi, I guess i try to answer my own question which end up with c

[GENERAL] hpw to Count without group by

2005-06-01 Thread Yudie Pg
Hello, I have a table, structure like this:   create table product(  sku, int4 not null,  category int4 null,  display_name varchar(100) null,  rank int4 null )   let say example data: sku, category, display_name === 10001, 5, postgresql, 132 10002, 5, mysql, 243 10003, 5, oracl

Re: [GENERAL] Empty date

2005-03-30 Thread Yudie Pg
> In my client be empty value for date fields ('. . ') , and I would > like to use NULL values and empty values also. What is your reason to put empty value ('') as alternative of null value? ---(end of broadcast)--- TIP 7: don't forget to inc

Re: [GENERAL] do I need replication or something else?

2005-03-29 Thread Yudie Pg
On Tue, 29 Mar 2005 16:00:37 -0500, John Burger <[EMAIL PROTECTED]> wrote: > >> If it were me, and someone proposed a model where two-way replication > >> was needed, I would tell them to rethink their model. It's broken. > > > > I would respectfully disagree that the requirement for two-way > > r

Re: [GENERAL] sub query constraint

2005-03-28 Thread Yudie Pg
> One way to do this is to add a write_access column to actions and use > a constraint to force it to be true. >Create a UNIQUE key of > (name, write_access) for user_data and then add a FOREIGN KEY > reference from (name, write_access) in actions to (name, write_access) > in user_data. Yes the

Re: [GENERAL] Table partition for very large table

2005-03-28 Thread Yudie Pg
> > create index prdt_new_url_dx on prdt_new (url) > > create index prdt_new_sku_dx on prdt_new (sku) > > create index prdt_old_sku_dx on prdt_old (sku) > > create index prdt_new_url_null_dx on prdt_new (url) where prdt_new.url > > IS NULL I added indexes & redo the analyze - Query plan looks bett

Re: [GENERAL] Table partition for very large table

2005-03-28 Thread Yudie Pg
> Also, this is important, have you anayzed the table? I'm guessing no, > since the estimates are 1,000 rows, but the has join is getting a little > bit more than that. :) > > Analyze your database and then run the query again. I analyze the table and it decrease number of rows in nested loop o