Re: [SQL] aggregate functions, COUNT

2001-10-02 Thread Kevin Way
* Tom Lane <[EMAIL PROTECTED]> [02-10-01 18:02]: > Stephan Szabo <[EMAIL PROTECTED]> writes: > > I think you could use EXISTS for that, > > select EXISTS (); should give a true/false on whether the > > query returned any rows. I'm not sure if it stops after one row > > or not, but if it doesn't

Re: [SQL] jdbc driver

2001-10-02 Thread Barry Lind
Esteban, Try http://jdbc.postgresql.org thanks, --Barry PS. There is a pgsql-jdbc mail list which would be a more appropriate place for this question. Esteban Gutierrez Abarzua wrote: > hi. > > who to knows about the java + postgresql (jdbc)? > > I need to know where can I get the

[SQL] jdbc driver

2001-10-02 Thread Esteban Gutierrez Abarzua
hi. who to knows about the java + postgresql (jdbc)? I need to know where can I get the driver for conection postgres and java 1.2? thanks. ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropr

Re: [SQL] aggregate functions, COUNT

2001-10-02 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > I think you could use EXISTS for that, > select EXISTS (); should give a true/false on whether the > query returned any rows. I'm not sure if it stops after one row > or not, but if it doesn't you can add a limit 1 to the query. Yes it does stop after

Re: [SQL] Stupid Question

2001-10-02 Thread Devrim GUNDUZ
<<< No Message Collected >>> ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Re: [SQL] aggregate functions, COUNT

2001-10-02 Thread Stephan Szabo
On Tue, 2 Oct 2001, Kevin Way wrote: > I'm currently using a SELECT count(*) when all I really want to know is > if 1 or more records exist. Is there a standard way to just find out if > a record exists? If not, is there a way to avoid iterating over all the > records by writing an aggregate fu

[SQL] Indexing behavior

2001-10-02 Thread Josh Berkus
Folks, Q: Are brand-new rows included in PostgreSQL indexed immediately? Detail: I have several "keyset holding" tables where lists of primary key ids are inserted for immediate retrieval by the user. After a few retrievals, these keysets are not used again. The purpose of this arrangement is

Re: [SQL] Question about indexing!

2001-10-02 Thread Stephan Szabo
On Tue, 2 Oct 2001, [euc-kr] Jeong Jaeick, Á¤ÀçÀÍ wrote: > select * from pgsql_bbs where topic = 'qna' and deleted < 2 >order by gid desc, pos asc limit 20, 0; > > But this query is not using index! > > The next is result of explain of this query: > > dsn=# explain select * from pgsq

[SQL] aggregate functions, COUNT

2001-10-02 Thread Kevin Way
I'm currently using a SELECT count(*) when all I really want to know is if 1 or more records exist. Is there a standard way to just find out if a record exists? If not, is there a way to avoid iterating over all the records by writing an aggregate function? Given what I've read of how they work

Re: [SQL] faster and faster!!

2001-10-02 Thread Tom Lane
bpalmer <[EMAIL PROTECTED]> writes: > - I have a query: > SELECT stamp > FROM table > WHERE > timestamp > now() - INTERVAL '1 0:00' > This query takes 13 seconds to run. It's probably not being indexed (use EXPLAIN to check). The problem is that "now() - INTERVAL '1 0:00'" is not considered a

Re: [SQL] strange query execution times

2001-10-02 Thread Tom Lane
Markus Bertheau <[EMAIL PROTECTED]> writes: > r_kunden_anbieter describes the relationship between customers and > suppliers. there are five status, 0 to 4 in attribute beziehung. both > queries return the same results. they select all customers which have a > certain relationship (beziehung = 3)

Re: [SQL] Stupid Question

2001-10-02 Thread Nils Zonneveld
Rebekah Kirk wrote: > > I want to create a table and for whatever reason it will not accept the > command, can anyone say what is wrong as I am very new to Postgres, thanks: > > CREATE TABLE cmpnycontacts ( > ContactNo integer(10) NOT NULL SERIAL, > CmpnyNo varchar(6) NOT NULL, > FirstName v

Re: [SQL] Aggregate Aggravation

2001-10-02 Thread Robin's PG-SQL List
Indeed I do. I need to add another constraint on that query. It never would have occurred to me had I not asked. Problem solved. Thank you, thank you! -Robin On Thu, 27 Sep 2001, Tom Lane wrote: > "Robin's PG-SQL List" <[EMAIL PROTECTED]> writes: > > I have a query using the SUM() function

Re: [SQL] TEXT in select

2001-10-02 Thread Michael Remme
Yes, you are right. The error was, that i saved long text as part of a prepared statement by using the ascii-stream. Yesterday i recognized (at least), that i can save without any problem long text as part of a normal insert-string. And then the queries are working like they should. Sometimes eve

Re: [SQL] 7.0.3 and 7.1.3 different results?

2001-10-02 Thread Tom Lane
Joel Mc Graw <[EMAIL PROTECTED]> writes: > A query such as "select sum(pages) from job_documents where > delivery_type='print'" returned 0 in version 7.0.3 if there were no rows > matching the query. In 7.1.3 the result is NULL if no rows match the > query. Why the change? Which result is "corr

Re: [SQL] A bug in triggers PG 7.1.3 or misunderstand ?

2001-10-02 Thread Domingo Alvarez Duarte
[EMAIL PROTECTED] (Tom Lane) wrote in message news:<[EMAIL PROTECTED]>... > I think you need "return old", not "return new", in the body of the > trigger if you want the delete to take place. new would be NULL in > a delete situation ... > > regards, tom lane > > -

[SQL] Question about indexing!

2001-10-02 Thread Jeong Jaeick, 정재익
I made the table like this; dsn=# \d pgsql_bbs Table "pgsql_bbs" Attribute | Type |Modifier -+-+- id | integer | not null default nextval('pgsq

[SQL] strange query execution times

2001-10-02 Thread Markus Bertheau
Hi guys, cenes_test=# select version(); version --- PostgreSQL 7.0.3 on i686-pc-linux-gnu, compiled by gcc 2.95.2 (1 row) cenes_test=# \d personen Table "perso

[SQL]

2001-10-02 Thread sreedhar
hi   how can i acheive AutoIncrement in postgresql. please what is the equivalent way of stored procedures in postgresql.   please mail to below address also.   regards, sreedhar   mail : [EMAIL PROTECTED]  

[SQL] Stupid Question

2001-10-02 Thread Rebekah Kirk
I want to create a table and for whatever reason it will not accept the command, can anyone say what is wrong as I am very new to Postgres, thanks: CREATE TABLE cmpnycontacts ( ContactNo integer(10) NOT NULL SERIAL, CmpnyNo varchar(6) NOT NULL, FirstName varchar(30) NOT NULL, Surname varchar(30)

[SQL] faster and faster!!

2001-10-02 Thread bpalmer
Two questions: - Does the order of WHERE clauses make a difference? I was trying to make some of my code faster and tried switching two clauses that should have effected the query, but there was no speed difference. - I have a query: SELECT stamp FROM table WHERE timestamp > now() - INTERVA

[SQL] Function return rows?

2001-10-02 Thread Pat M
Can I use a function to execute a query and return a row or set of rows? If so, can you point me to some examples or perhaps give me an example of a function that would do roughly the same thing as: select * from mytable where mytable.name ~* 'aname'; I can't seem to find any examples that retur

[SQL] 7.0.3 and 7.1.3 different results?

2001-10-02 Thread Joel Mc Graw
A query such as "select sum(pages) from job_documents where delivery_type='print'" returned 0 in version 7.0.3 if there were no rows matching the query. In 7.1.3 the result is NULL if no rows match the query. Why the change? Which result is "correct" according to the SQL standard? I'm running