Re: [SQL] limit 1 and functional indexes

2004-01-29 Thread Greg Stark
Bruno Wolff III <[EMAIL PROTECTED]> writes: > >QUERY PLAN > > > > Sort (cost=11824.16..11831.5

Re: [SQL]

2004-01-29 Thread Chris Travers
You can also use PGexecParams() (see the libpq documentation).  It can be a little more cumbersome to use, though.   Best Wishes, Chris Travers - Original Message - From: MUKTA To: [EMAIL PROTECTED] Sent: Thursday, January 29, 2004 8:08 PM Subject: [SQL]

Re: [SQL] [PERFORM] Set-Returning Functions WAS: On the performance of views

2004-01-29 Thread Josh Berkus
Bill, > I don't understand at all. If I do "SELECT * FROM > set_returning_function()" and all I'm going to do is iterate through the > columns and rows, adding them to a two dimensional array that will be > marshalled as a SOAP message, what about not knowing the nature of the > return set can ca

Re: [SQL] java.lang.StringIndexOutOfBoundsException: String index

2004-01-29 Thread Josh Berkus
Mohan, > DEBUG] Transaction - -called safeRollback with null argument > java.sql.SQLException: ERROR: SET AUTOCOMMIT TO OFF is no longer supported > at This is because "SET AUTOCOMMIT TO OFF" *is* no longer supported. Are you sure that you have the latest JDBC? Also, this should be o

Re: [SQL] java.lang.StringIndexOutOfBoundsException: String index

2004-01-29 Thread mohan
Now i a get another wierd error DEBUG] Transaction - -called safeRollback with null argument java.sql.SQLException: ERROR: SET AUTOCOMMIT TO OFF is no longer supported at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:131) at org.postgresql.jdbc1.AbstractJdbc1Connect

Re: [SQL] [PERFORM] Set-Returning Functions WAS: On the performance of views

2004-01-29 Thread Josh Berkus
Bill, First off: discussion moved to the SQL list, where it really belongs. > Well, I would have agreed with the uselessness, until this project. The > "source of endless debugging" frightens me! Well, the last time I tried to use this capability was SQL Server 7. On that model, the problem

Re: [SQL] LEFT JOIN on one and/or another column (thanks)

2004-01-29 Thread Octavio Alvarez
Yes, Bruno. Thank you very much. That's what I was looking for, but since I hadn't used CASE nor COALESCE, I didn't know it was easier that way. The idea is that on a column I have info about a routine task, and in another one I have info about human-made changes to the time of that task, like as

Re: [SQL] query not using index for descending records?

2004-01-29 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > Yeah, that's what I figured. I thought it might be useful for people to > play with though since at least for the integer/float types writing C > versions of the comparitors is easy. I was thinking for real it'd be nice > to be able to use the normal com

Re: [SQL] query not using index for descending records?

2004-01-29 Thread Stephan Szabo
On Thu, 29 Jan 2004, Tom Lane wrote: > Stephan Szabo <[EMAIL PROTECTED]> writes: > > I'd thought that I'd previously sent a message containing a set of > > definitions for the reverse opclasses (not meant for inclusion to the > > system because I was making SQL functions that basically did - > com

Re: [SQL] How to retrieve N lines of a text field.

2004-01-29 Thread Joe Conway
Chris Travers wrote: This is a complex issue, and i am tryign to figure out how to use regular expressions to resolve this issue. I need to retrieve the first N lines of a text field. N would be assigned using a parameterized query, if possible. How 'bout something like this: CREATE OR REPLACE F

Re: [SQL] query not using index for descending records?

2004-01-29 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > I'd thought that I'd previously sent a message containing a set of > definitions for the reverse opclasses (not meant for inclusion to the > system because I was making SQL functions that basically did - comparison function> to use as the function of the

Re: [SQL] java.lang.StringIndexOutOfBoundsException: String index

2004-01-29 Thread Achilleus Mantzios
O kyrios [EMAIL PROTECTED] egrapse stis Jan 29, 2004 : > Hi All > > I am having the torque3.1.jar and postgresql-7.4. I have compiled the new > jdbc driver called as postgresql.jar and have placed it in the lib > directory from where the ant scripts catch the jars. Whenever i try to > access thro

[SQL] java.lang.StringIndexOutOfBoundsException: String index out of range: 23 at java.lang.String.charAt(String.java:460)

2004-01-29 Thread mohan
Hi All I am having the torque3.1.jar and postgresql-7.4. I have compiled the new jdbc driver called as postgresql.jar and have placed it in the lib directory from where the ant scripts catch the jars. Whenever i try to access through torque gestList = BaseGestlistPeer.doSelect(new Criteria()); t

Re: [SQL] query not using index for descending records?

2004-01-29 Thread Stephan Szabo
On Thu, 29 Jan 2004, Bruno Wolff III wrote: > On Thu, Jan 29, 2004 at 15:29:11 +0200, > Achilleus Mantzios <[EMAIL PROTECTED]> wrote: > > O kyrios Bruno Wolff III egrapse stis Jan 29, 2004 : > > > > As i see there was a thread > > http://archives.postgresql.org/pgsql-hackers/2003-05/msg00762.ph

Re: [SQL] How to retrieve N lines of a text field.

2004-01-29 Thread Tom Lane
"Chris Travers" <[EMAIL PROTECTED]> writes: > However, this always selects every line but the final one (because %\n seems > to be interpreted to be the largest possible string, while I want it to be > the smallest possible string). I don't think you can solve this in SQL99 regular expressions, bu

Re: [SQL] limit 1 and functional indexes

2004-01-29 Thread Bruno Wolff III
On Thu, Jan 29, 2004 at 16:02:06 +0100, Alexandra Birch <[EMAIL PROTECTED]> wrote: > > Here is the output of EXPLAIN ANALYZE first with limit 1 then without: The time estimate for the limit 1 case is way off. I can't tell if that is a bug or not having detailed enough statistics. Hopefully som

[SQL] How to retrieve N lines of a text field.

2004-01-29 Thread Chris Travers
Hi all; This is a complex issue, and i am tryign to figure out how to use regular expressions to resolve this issue. I need to retrieve the first N lines of a text field. N would be assigned using a parameterized query, if possible. I had thought about using something like: select substring(tes

Re: [SQL] query not using index for descending records?

2004-01-29 Thread Achilleus Mantzios
O kyrios Bruno Wolff III egrapse stis Jan 29, 2004 : > On Thu, Jan 29, 2004 at 15:29:11 +0200, > Achilleus Mantzios <[EMAIL PROTECTED]> wrote: > > O kyrios Bruno Wolff III egrapse stis Jan 29, 2004 : > > > > As i see there was a thread > > http://archives.postgresql.org/pgsql-hackers/2003-05/ms

Re: [SQL] limit 1 and functional indexes

2004-01-29 Thread Alexandra Birch
> > > > Postgres choses the wrong index when I add limit 1 to the query. > > This should not affect the index chosen. > > I don't know the complete answer to your question, but since no one else > has commented I will answer what I can. Thanks - your reply is apreciated :) > It IS reasobable for

Re: [SQL]

2004-01-29 Thread MUKTA
Hi!!  wow, ur help was extremely helpfull! thanx a bunch! i just joined this pgsql project 2 days ago so i dunno bout php etc, i guess i wont need to use the ecpg stuff for now.. Thanx a lot! Bye PS: how did u know i was an artist! :) - Original Message - From: Viorel Dragomir

Re: [SQL] query not using index for descending records?

2004-01-29 Thread Bruno Wolff III
On Thu, Jan 29, 2004 at 15:29:11 +0200, Achilleus Mantzios <[EMAIL PROTECTED]> wrote: > O kyrios Bruno Wolff III egrapse stis Jan 29, 2004 : > > As i see there was a thread > http://archives.postgresql.org/pgsql-hackers/2003-05/msg00762.php > dealing with this issue, assuming the "correct" order

Re: [SQL] query not using index for descending records?

2004-01-29 Thread Achilleus Mantzios
O kyrios Bruno Wolff III egrapse stis Jan 29, 2004 : As i see there was a thread http://archives.postgresql.org/pgsql-hackers/2003-05/msg00762.php dealing with this issue, assuming the "correct" order by should be "order by datetime ASC, id DESC". Do you know of any progress for declaring the dir

Re: [SQL]

2004-01-29 Thread email
You might also consider using ecpg which allows a syntax like: int a, b, c; EXEC SQL INSERT INTO mytable ( :a, :b, :c ); See http://www.postgresql.org/docs/current/interactive/ecpg.html for details. HTH Jürgen Viorel Dragomir <[EMAIL PROTECTED]> schrieb am 29.01.2004, 14:11:44: > So, you are

Re: [SQL] query not using index for descending records?

2004-01-29 Thread Bruno Wolff III
On Thu, Jan 29, 2004 at 22:18:08 +1000, email lists <[EMAIL PROTECTED]> wrote: > Limit (cost=0.00..2.31 rows=20 width=12) >-> Index Scan using idx_trafficlogs_datetime_id on trafficlogs > (cost=0.00..1057.89 rows=9172 width=12) > (2 rows) > > however, I am wanting to return the last 20 re

Re: [SQL]

2004-01-29 Thread Viorel Dragomir
So, you are an artist. Isn't it? :) Your query is actually a string. This is your string: INSERT into table values(a,b,c,d)   You must change your string to actually use values of tha a, b... You can make this string with sprintf sprintf(string, "INSERT into table values(%d,%d,%d,%d)", a, b, c

[SQL]

2004-01-29 Thread MUKTA
Hi I have an urgent problem I want to insert values into a table using the C syscalls provided by the libpq library, but i find that i can not insert into the table when i use variables instead of values...like so: int a,b,c,d; using the C function   res=PQexecute(Conn,"INSERT into table va

Re: [SQL] SQL Query for Top Down fetching of childs

2004-01-29 Thread Kumar
Thanks a lot Mr.Richard Huxton. It managed to find a similar one and modified to my need. It is working fine. Thanks a lot - Original Message - From: "Richard Huxton" <[EMAIL PROTECTED]> To: "Kumar" <[EMAIL PROTECTED]>; "psql" <[EMAIL PROTECTED]> Sent: Thursday, January 29, 2004 3:57 PM Su

Re: [SQL] LEFT JOIN on one and/or another column

2004-01-29 Thread Bruno Wolff III
On Wed, Jan 28, 2004 at 20:27:00 -0800, Octavio Alvarez <[EMAIL PROTECTED]> wrote: > > Hi. I have a table with two foreign keys (1 field each), like in > > id| serial > ext_key_original | integer > ext_key_exception | integer > > They mean different things, as one refers to

Re: [SQL] limit 1 and functional indexes

2004-01-29 Thread Bruno Wolff III
On Wed, Jan 28, 2004 at 12:23:38 +0100, Alexandra Birch <[EMAIL PROTECTED]> wrote: > Hi, > > Postgres choses the wrong index when I add limit 1 to the query. > This should not affect the index chosen. I don't know the complete answer to your question, but since no one else has commented I will

[SQL] query not using index for descending records?

2004-01-29 Thread email lists
Hi All, I have this table; id - Serial datetime - timestamp without timezone with the index as index idx_trafficlogs_datetime_id on trafficlogs using btree (datetime,id); When performing the following query: explain select datetime,id from trafficlogs order by datetime,id limit 20;

Re: [SQL] SQL Query for Top Down fetching of childs

2004-01-29 Thread Richard Huxton
On Thursday 29 January 2004 06:11, Kumar wrote: > Dear Friends, > > Postgres 7.3.4 on RH Linux 7.2. > > I need a query to get the Childs of a parent (Top down analysis). Need to > list all the departments(Childs) of a parent organization. The table > structure is Two places to look for examples: 1

Re: [SQL] time series data

2004-01-29 Thread azwa
Hi,   thanks for the feedback. btw i've run the statement below  & got the following result :     time_key | yr_id | month_id | month_desc | day_id               --+---+--++                       193 |  1994 |               7 |             jul        |  

Re: [SQL] auto_insert

2004-01-29 Thread Viorel Dragomir
serial   ex:   create table a( i serial, b int);   bye   - Original Message - From: jodi To: [EMAIL PROTECTED] Sent: Thursday, January 29, 2004 10:27 Subject: [SQL] auto_insert I'm looking function at postrgeSQL the same like "auto_insert " function at mySQL

[SQL] auto_insert

2004-01-29 Thread jodi
I'm looking function at postrgeSQL the same like "auto_insert " function at mySQL