Re: [SQL] Case Sensitive "WHERE" Clauses?

2002-09-27 Thread Stephan Szabo
On Fri, 27 Sep 2002, Ian Barwick wrote: > On Friday 27 September 2002 05:19, Tom Lane wrote: > > Ian Barwick <[EMAIL PROTECTED]> writes: > > > Anyone know what the ANSI standard is? I don`t recall any other > > > database apart from MySQL which default to case-insensitive > > > CHAR or VARCHAR co

[SQL] Date/Time types

2002-09-27 Thread Seb
Hello, I'm french, so excuse me if my english is not correct. I'd like to create a table with a Timestamp row (named date for example) and width a resolution as smaller as possible (1 microsecond if possible). What is exactly the correct query for that question ? The query I've written is : CR

[SQL] Null not equal to '' (empty)

2002-09-27 Thread Ajit Aranha
Why is ''(empty) not equal to null? Its a major headache when porting from other RDBMS like Oracle. Anyone knows any easy workarounds? i.e. if you use:create table tbl ( c1 varchar(5)); insert into tbl values (''); select * fro

Re: [SQL] Two Permance Questions

2002-09-27 Thread CoL
The select without subselect of course is better, and faster. Check your "explain analyze select ..." to se the performance, and to check the index usage if any. C. CN LIOU wrote: > Hi! > > Q1. Is subquery better or join? > > For subquery: > > SELECT t1.c1,(SELECT t2.c2 FROM t2 WHERE t2.c1 =

Re: [SQL] [GENERAL] Monitoring a Query

2002-09-27 Thread Neil Conway
Bruce Momjian <[EMAIL PROTECTED]> writes: > Aaron Held wrote: > > Is there any way to monitor a long running query? > > Oh, sorry, you want to know how far the query has progressed. Gee, I > don't think there is any easy way to do that. Would it be a good idea to add the time that the current q

Re: [SQL] HELP w/ SQL -- distinct select with non distinct fields?

2002-09-27 Thread John Gilson
"RVL" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm work with Sybase on the Sun... and, being a clueles newbee in SQL > department, hope you could help. I have a set of data: > > acct name qty link date memo > 101 item_A 100 0001 9/2/02 blah

[SQL] HELP w/ SQL -- distinct select with non distinct fields?

2002-09-27 Thread RVL
I'm work with Sybase on the Sun... and, being a clueles newbee in SQL department, hope you could help. I have a set of data: acct name qty link date memo 101 item_A 100 0001 9/2/02 blah 101 item_A 250 0001 9/3/02 n/a 101 item_A80 0002 9/3/02 n/a 101 item_B90 000

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-27 Thread Martijn van Oosterhout
On Mon, Sep 23, 2002 at 09:02:00PM +0200, Manfred Koizar wrote: > On Mon, 23 Sep 2002 13:05:42 -0400, Tom Lane <[EMAIL PROTECTED]> > >We concluded that the spec defines the behavior as > >implementation-dependent, > > AFAICT the spec requires the returned value to meet two conditions. > > C1: If

Re: [SQL] [GENERAL] Monitoring a Query

2002-09-27 Thread Alvaro Herrera
Bruce Momjian dijo: > Roberto Mello wrote: > > Forgive my ignorance here, but what is GUC? And how would I access the > > query duration? > > GUC is postgresql.conf and SET commands. They are variables that can be > set. Just for the record, GUC is an acronym for "Grand Unified Configuration

[SQL] database abstraction -> functions

2002-09-27 Thread Jeroen Olthof
Hi, When developing applications is a good thing to create abstraction between different layers The one concerning the database would be the persistence layer. To create such abstraction I want all mij datababase activitie runned through functions. But how can I return a set of rows instead of a

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-27 Thread Ross J. Reedstrom
On Tue, Sep 24, 2002 at 10:33:51AM +0200, Manfred Koizar wrote: > > The people who wrote the specification knew about transactions. If > they had wanted what you describe above, they would have written: > > 3) If a transaction generally contains more than one reference > to one or more s

[SQL] lastoid from sql

2002-09-27 Thread CoL
Hi, how can I get tha lastoid variable from sql? thx. C. ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] lastoid from sql

2002-09-27 Thread CoL
select :LASTOID; sorry! :) and thx;) CoL wrote: > Hi, > > how can I get tha lastoid variable from sql? > > thx. > > C. ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-27 Thread Haller Christoph
> > Christoph Haller wrote: > > Hi pgsql-sql list, > > I did some testing around tables using a column > > timestamp with time zone not null default now(). > > I have noticed a valuable feature: > > As long as being inside a transaction initiated by > > begin; > > the return value of the now() fun

Re: [SQL] Dublicates pairs in a table.

2002-09-27 Thread Kevin Houle
Ries van Twisk wrote: > I have a small question which I could not clearly find in the postgreSQL > manual. > > if I create this table and index > CRAEATE TABLE test ( > id SERIAL, > c1 VARCHAR(32), > c2 VARCHAR(32), > c3 VARCHAR(32) > ); > > CREATE UN

[SQL] function return multiply rows

2002-09-27 Thread Jeroen Olthof
What is going wrong here? An example of what I'm trying to do. vw_teams is a view but same problem when trying it on a single table CREATE FUNCTION test() RETURNS SETOF vw_teams AS 'select * from vw_teams;' LANGUAGE 'sql'; SELECT test(); results in test --- 137789256 137789256 (

[SQL] Is it possible to use lo_write in SQL?

2002-09-27 Thread Boulgakov Andrei
Hi! Is it possible to use lo_write in SQL? If so, how? ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

[SQL] PL/pgsql

2002-09-27 Thread Gustavo Tadao Okida
Hi, I'm a new PostgreSql user but I have some experience in Oracle. So I decided to use PL/pgsql to build my procedure (functions). I create an database called MyDatabase and add this language into it with: createlang plpgsql MyDatabase. After this, I wrote a function with pgaccess : Nam

[SQL] query problem "server sent binary data ... without prior row description ..."

2002-09-27 Thread jonesbl
I'm having a problem with postgres on HPUX. My version is: VERSION = 'PostgreSQL 7.2.2 on hppa2.0w-hp-hpux11.11, compiled by aCC -Ae' I'm trying to do a query and it consistently gives the following errors: wily=# \a

[SQL] Help tuning query

2002-09-27 Thread Kevin Traub
All; Can anyone please help with the tuning of this query? With 77000 rows in the operator_messages database the query is taking almost 15 seconds to return. Preference woul dbe under 5 seconds if possible. System load on a dual processor P3 with 1.5GB of memory remains under .4 during the query

Re: [SQL] Case Sensitive "WHERE" Clauses?

2002-09-27 Thread Jochem van Dieten
Ian Barwick wrote: > > Anyone know what the ANSI standard is? I don`t recall any other > database apart from MySQL which default to case-insensitive > CHAR or VARCHAR columns. SQL:1999 says collation dependent. Jochem ---(end of broadcast)--- TI

[SQL] 7.3 schemas

2002-09-27 Thread Andreas Joseph Krogh
Hi! I've just started to look at 7.3, and have created a schema with the "CREATE SCHEMA" command. How do I use/connect to theese schemas? I also want to use the schemas form JDBC, how is the connect-URL sopposed to be? Any links to docs on the new schema support are appreciated. -- Andreas Jos

Re: [SQL] Null not equal to '' (empty)

2002-09-27 Thread Ries van Twisk
This is because '' is not equal to NULL '' Means a empty string NULL means a empty set So this: SELECT * FROM tbl WHERE c1 IS NULL; is totally different then: SELECT * FROM tbl WHERE c1=''; Ries -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Namens Ajit Ara

Re: [SQL] Null not equal to '' (empty)

2002-09-27 Thread Richard Huxton
On Friday 20 Sep 2002 7:09 am, Ajit Aranha wrote: > Why is ''(empty) not equal to null? Its a major headache when porting > from other RDBMS like Oracle. Anyone knows any easy workarounds? By definition it is different - null means "not known" or "no value" not empty string. Do you think it sho

Re: [SQL] Dublicates pairs in a table.

2002-09-27 Thread Richard Huxton
On Wednesday 25 Sep 2002 2:10 am, Kevin Houle wrote: > I have the same issue with a table that currently holds well > over 600,000 rows. The case you left out is this: > > INSERT INTO test (c1,c2) VALUES('a','c'); > INSERT INTO test (c1,c2) VALUES('c','a'); > > I want that to fail, but I haven

Re: [SQL] 7.3 schemas

2002-09-27 Thread Mathieu Arnold
--On vendredi 27 septembre 2002 11:42 + Andreas Joseph Krogh <[EMAIL PROTECTED]> wrote: > Hi! > > I've just started to look at 7.3, and have created a schema with the > "CREATE SCHEMA" command. How do I use/connect to theese schemas? I also > want to use the schemas form JDBC, how is the c

Re: [SQL] Date/Time types

2002-09-27 Thread Josh Berkus
Seb, > I'm french, so excuse me if my english is not correct. Whereas if you were a native English speaker, you would realize that there is no such thing as "correct English" > I'd like to create a table with a Timestamp row (named date for > example) and > width a resolution as smaller a

Re: [SQL] Passing array to PL/SQL and looping

2002-09-27 Thread Josh Berkus
Greg, > CREATE FUNCTION test_array( ) RETURNS VARCHAR[] AS ' > DECLARE > return_array VARCHAR[]; > BEGIN > return_array[0] := ''test''; > return_array[1] := ''test 1''; > return_array[2] := ''test 2''; > RETURN (return_array); > END;' > LANGUAGE 'plpgsql'; No, it's not possible

Re: [SQL] Dublicates pairs in a table.

2002-09-27 Thread Jean-Luc Lachance
What's wrong with CREATE UNIQUE INDEX foo_both_uniq ON foo(a,b); ??? Richard Huxton wrote: > > On Wednesday 25 Sep 2002 2:10 am, Kevin Houle wrote: > > I have the same issue with a table that currently holds well > > over 600,000 rows. The case you left out is this: > > > > INSERT INTO test

Re: [SQL] Dublicates pairs in a table.

2002-09-27 Thread Stephan Szabo
On Fri, 27 Sep 2002, Richard Huxton wrote: > On Wednesday 25 Sep 2002 2:10 am, Kevin Houle wrote: > > I have the same issue with a table that currently holds well > > over 600,000 rows. The case you left out is this: > > > > INSERT INTO test (c1,c2) VALUES('a','c'); > > INSERT INTO test (c1,

Re: [SQL] Null not equal to '' (empty)

2002-09-27 Thread Josh Berkus
Ajit, > Why is ''(empty) not equal to null? Its a major headache when > porting > from other RDBMS like Oracle. '' is not equal to NULL because that is the ANSI SQL92 and SQL99 international specification. The fact that other databases fail to follow the specification (and '' = NULL is *not*

Re: [SQL] Dublicates pairs in a table.

2002-09-27 Thread Richard Huxton
On Friday 27 Sep 2002 5:17 pm, Jean-Luc Lachance wrote: > What's wrong with > CREATE UNIQUE INDEX foo_both_uniq ON foo(a,b); > ??? Because he specifically wanted values of ('a','b') and ('b','a') to be treated as equivalent (see quote). > > > INSERT INTO test (c1,c2) VALUES('a','c'); > > >

Re: [SQL] function return multiply rows

2002-09-27 Thread Joe Conway
Jeroen Olthof wrote: > What is going wrong here? > > An example of what I'm trying to do. > > vw_teams is a view but same problem when trying it on a single table > CREATE FUNCTION test() RETURNS SETOF vw_teams AS 'select * from vw_teams;' > LANGUAGE 'sql'; > > SELECT test(); > > results in >

Re: [SQL] Dublicates pairs in a table.

2002-09-27 Thread Jean-Luc Lachance
Oh, sorry I missed that. Still if C1 and C2 are interchangable, a rule could force C1 <= C2 and swap them if necessary. Richard Huxton wrote: > > On Friday 27 Sep 2002 5:17 pm, Jean-Luc Lachance wrote: > > What's wrong with > > CREATE UNIQUE INDEX foo_both_uniq ON foo(a,b); > > ??? > > Becau

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-27 Thread Roland Roberts
SQL> create table rbr_foo (a date); Table created. SQL> begin 2 insert into rbr_foo select sysdate from dual; [...wait about 10 seconds...] 3 insert into rbr_foo select sysdate from dual; 4 end; 5 / PL/SQL procedure successfully completed. SQL> select * from rbr_foo; A --

[SQL] Constraint problems

2002-09-27 Thread GB Clark
Hello, I'm trying to create a constraint that will check to see if the inserted data is found in another column in the table. It could be that I'm going about this the wrong way, any clues for me? Here is the present setup data for the table. --SNIP-- -- -- -- DROP SEQUENCE sysusers_user_id_s

Re: [SQL] Constraint problems

2002-09-27 Thread Stephan Szabo
On Fri, 27 Sep 2002, GB Clark wrote: > CREATE TABLE sysusers ( > user_id INTEGER DEFAULT nextval('sysusers_user_id_seq') > UNIQUE NOT NULL PRIMARY KEY, > username text NOT NULL UNIQUE, > password

[SQL] PGSQL-Performance mailing list.

2002-09-27 Thread Josh Berkus
Hey, folks! I'm mailing to remind everyone about the new PGSQL-PERFORMANCE mailing list. This list was added about 2 weeks ago to provide a forum for the following topics: 1. Postgres server hardware tuning. 2. Postgresql.conf tweaking 3. Index management 4. VACUUMing, ANALYZE and STATISTICS

Re: [SQL] Constraint problems

2002-09-27 Thread GB Clark
On Fri, 27 Sep 2002 11:29:34 -0700 (PDT) Stephan Szabo <[EMAIL PROTECTED]> wrote: > On Fri, 27 Sep 2002, GB Clark wrote: > > > CREATE TABLE sysusers ( > > user_id INTEGER DEFAULT nextval('sysusers_user_id_seq') > > UNIQUE NOT NULL PRIMARY K

Re: [SQL] PL/pgsql

2002-09-27 Thread Ian Barwick
On Wednesday 25 September 2002 21:38, Gustavo Tadao Okida wrote: (...) > After this, I wrote a function with > pgaccess : > > Name: spi_novo_parametro paramters: > returns: char language: plpgsql > > DECLARE > val INTEGER :=1; > BEGIN > insert into