Re: [SQL] bug?

2003-01-01 Thread Tom Lane
Minghann Ho <[EMAIL PROTECTED]> writes: > The following SELECT are errors?! No, they're not. PG follows the ISO definition of week numbers: Monday is the first day of the week, and the first week of a year is the first one containing a Thursday. regards, tom lane ---

Re: [SQL] Slow self-join on a 100 million record table

2003-01-01 Thread Tom Lane
[EMAIL PROTECTED] (Mark Davies) writes: > The problem is, the self-join solution is extremely slow. I have a > SQL Server 7.0 database with a clustered index on TheWord (sequential > words) and a normal index on TheID. Kindly do not pester Postgres mailing lists with SQL Server questions.

Re: [SQL] empty arrays

2003-01-01 Thread Tom Lane
<[EMAIL PROTECTED]> writes: > # insert into test_table (test_column) values ( '{ }' ); Try it without the space: insert into test_table (test_column) values ( '{}' ); regards, tom lane ---(end of broadcast)--- TIP 2: you ca

[SQL] bug?

2003-01-01 Thread Minghann Ho
The following SELECT are errors?! tpcr=# select extract (week from date '2000-01-01'); date_part --- 52 (1 row) tpcr=# select extract (week from date '2000-01-02'); date_part --- 52 (1 row) Please check ... thanks Hans ---(end of broadc

Re: [SQL] Slow self-join on a 100 million record table

2003-01-01 Thread Andrew J. Kelly
Mark, I doubt very much you will ever get much faster results (without increasing hardware) in a situation such as that. Your queries don't look selective enough to effectively use the indexes. What is the query plan for each of the individual selects and what does it look like as a whole? How

[SQL] Slow self-join on a 100 million record table

2003-01-01 Thread Mark Davies
I have a database containing 100 million records, in which each record contains (in sequence) all of the words in a 100 million word collection of texts. There are two columns: TheID (offset value) and TheWord (sequential words), e.g.: TheID TheWord - 1 I 2 saw 3 the 4 man 5

[SQL] Doubts porting from Oracle to postgresql

2003-01-01 Thread Senthil
Hai everybody,   Hai,    Currently, I'm at the work of converting database from Oracle to Postgresql.   I have some doubts: 1) What is the equivalent of Oracle ROWNUM in Postgresql?  If there is no such equivalent, can U give me an idea about                 that? 2) How

[SQL] empty arrays

2003-01-01 Thread floyds
using: psql (PostgreSQL) 7.2.1 why does an empty array return an array of length 1 rather than array of length 0? one would think that the results below would have returned { } instead of {0}. simple test using psql: # create table test_table ( test_column integer[] ); CREATE # insert into test

[SQL] Multiple counts

2003-01-01 Thread Colin Fox
Hi, all. I'm trying to calculate two count()s. I have a campaigns table, a campaign_parts table and a people table. Here is a simplified view of 3 tables I'm trying to use: create table campaigns {id serial, company_id int, name varchar(20)); create table campaign_parts(id serial, campaign_id

Re: [SQL] Stuck on SQL Query where a calculated value is used for a join.

2003-01-01 Thread ScottRArndt
Never mind ... a good night's sleep with my subconscious working on the problem yielded: SELECT reg_type.reg_type_desc "Registration Type", CASE result.result_defn WHEN NULL THEN CONVERT(VARCHAR,reg_stats.result_code) ELSE result.result_defn END 'Result', reg_stats.create_date "Create Da

[SQL] Reference integrity question

2003-01-01 Thread Evgen Potemkin
Good time of day! I have two tables news(newsid int4, newscltid int4 references clt(cltid) match full,newstext text) and clt(cltid int4, somedata text). after clt is renamed , for ex. to clt_old, newscltid start to reference to clt_old.cltid. i'm create new table clt(cltid int4, anotherdata

[SQL] CREATE INDEX question

2003-01-01 Thread Hans-Jürgen Schönig
Is there a way to influence the data type of an index being created? Some like that would be fine: CREATE INDEX idx_data2_x ON t_data2(x::int4); It would be nice to have a workaround for that: [hs@backup mag]$ time psql -p 5400 test -c "EXPLAIN SELECT * FROM t_data1 WHERE id > (SELECT AVG(id

[SQL] Execution Plans and Casts

2003-01-01 Thread Hans-Jürgen Schönig
Does anybody know how the planner treats casts? It seems as if casts are not taken into consideration when planning the query because the costs seem to stay the same. [hs@backup mag]$ psql -p 5400 test -c "EXPLAIN SELECT id FROM t_data1" QUERY PLAN ---

[SQL] Internal functions documented

2003-01-01 Thread Daniel Bruce Lynes
I've noticed a lot of the functions that are documented for libpg are also stored in pg_proc. Are these functions additionally callable from pl/pgsql? And if so, are they documented for pl/pgsql anywhere, or do we need to make educated guesses as to the parameters for them under pl/pgsql? For