[SQL] getting ILIKE or ~* to use indexes....

2002-08-09 Thread Rajesh Kumar Mallah.
Hi folks, can anyone tell me or point me to the right thread. I want my query to use indexes for company name searches but its not happening unless is use '=' which does not server the purpose. eg tradein_clients=# explain SELECT co_name FROM unified_data where co_name ilike '%rajesh%' ; N

Re: [SQL] retrieving all rows from a "tree" in one select - how ?

2002-08-09 Thread Oleg Bartunov
folk, have you looked at ltree ? http://www.sai.msu.su/~megera/postgres/gist/ltree/ Regards, Oleg On Fri, 9 Aug 2002, Adam Erickson wrote: > I'll be curious to see the responses to this. I myself deal with this same > situation every day. Although we're currently using MySQL but mov

Re: [SQL] retrieving all rows from a "tree" in one select - how ?

2002-08-09 Thread Josh Berkus
Guys, Check out Joe Celko's two chapters on tree structures in the 2nd edition of "SQL for Smarties". It's pretty comprehensive. -- -Josh Berkus Aglio Database Solutions San Francisco ---(end of broadcast)--- TIP 6: Have you searched our lis

Re: [SQL] How to update record in a specified order

2002-08-09 Thread Josh Berkus
JLL, So, you want to update a field with a NEXTVAL counter, but with the counter ordered by another column? If so, you will have to use a procedure. Ordering your UPDATEs is not part of SQL -- it requires a procedural element. Here's a simple procedure (you debug it): CREATE PROCEDURE ad

Re: [SQL] retrieving all rows from a "tree" in one select - how ?

2002-08-09 Thread Adam Erickson
I'll be curious to see the responses to this. I myself deal with this same situation every day. Although we're currently using MySQL but moving it to postgres (which is why I'm on these lists..) > -- select a tree starting with node 1234 and all its descendants: > SELECT * FROM t WHERE id=1234

Re: [SQL] How to update record in a specified order

2002-08-09 Thread Dan Langille
On 9 Aug 2002 at 14:37, Josh Berkus wrote: > JLL, > > > I want to update a field with a 'NEXTVAL', but I want the record updated > > in a specific order. > > Any simple way of doing this other than having to create a temp table? > > Please be more speciifc. What do you mean, "specified order"?

Re: [SQL] How to update record in a specified order

2002-08-09 Thread Jean-Luc Lachance
As in an order by clause... If it existed. Josh Berkus wrote: > > JLL, > > > I want to update a field with a 'NEXTVAL', but I want the record updated > > in a specific order. > > Any simple way of doing this other than having to create a temp table? > > Please be more speciifc. What do you me

Re: [SQL] How to update record in a specified order

2002-08-09 Thread Josh Berkus
JLL, > I want to update a field with a 'NEXTVAL', but I want the record updated > in a specific order. > Any simple way of doing this other than having to create a temp table? Please be more speciifc. What do you mean, "specified order"? -- -Josh Berkus Aglio Database Solutions San Franci

[SQL] retrieving all rows from a "tree" in one select - how ?

2002-08-09 Thread h012
Hi, I realize that a relational database may not be ideal for storing (and retrieving) tree-like strucutres, but it looks like you guys are doing with PostgreSQL the impossible anyway. Having table t of all nodes: CREATE SEQUENCE nodeIDseq START 1; CREATE TABLE t( id int PRIMARY

Re: [SQL] SQL syntax

2002-08-09 Thread Jean-Luc Lachance
Well It's Friday and I am still geting vacation messages from Bob Tom Lane wrote: > > Jean-Luc Lachance <[EMAIL PROTECTED]> writes: > > Can someone *please* temporarely remove > >"Bob Powell" <[EMAIL PROTECTED]> > > from the list so we do not get a vacation message for eve

[SQL] How to update record in a specified order

2002-08-09 Thread Jean-Luc Lachance
Hi all, I want to update a field with a 'NEXTVAL', but I want the record updated in a specific order. Any simple way of doing this other than having to create a temp table? JLL ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? h

Re: [SQL] expressions operating on arrays

2002-08-09 Thread h012
Great ! I'll try patching it. Thanks Oleg & Teodor for doing all this great work ! Long live PostgreSQL ! see yea, John On Fri, 9 Aug 2002, Oleg Bartunov wrote: > Hmm, > > you dont' need to use GiST supporting functions ! > We've posted a patch to current CVS, it has everyt

Re: [SQL] expressions operating on arrays

2002-08-09 Thread Oleg Bartunov
Hmm, you dont' need to use GiST supporting functions ! We've posted a patch to current CVS, it has everything you need. Please, check http://www.sai.msu.su/~megera/postgres/gist/code/7.3/README.intarray It looks like that patch should works with 7.2 also. Oleg On Fri, 9 Aug 2002 [EMAIL

Re: [SQL] Table Sorting and Limit Question

2002-08-09 Thread Dawn Hollingsworth
Since the id is a sequence type it should be unique. In this case it also happens to be my primary key into this table which will also make it unique. So the query below would only return 1 row. The part I'm missing is the offset number of the limit. Is there any way to figure out which offset

Re: [SQL] expressions operating on arrays

2002-08-09 Thread Tom Lane
[EMAIL PROTECTED] writes: > w.r.t. modifying the array contents: I looked through > /usr/lib/pgsql/contrib/intarray/_int.sql.in , but it didn't make me any > smarter. Are the "..._union" and "..._picksplit" functions supposed to add > into and remove elements from the arrays ? No, those are s