Re: [SQL] Case in-sensitive

2002-07-24 Thread Josh Berkus
Chris, > > Can I config the Postgresql so that it can match case > > in-sensitive pattern > > automatically? i.e. I don't need to explicit convert the pattern to lower > > case like this: .WHERE lower(textfield) LIKE lower(pattern) > > All you need to do is this: > > ..WHERE textfield I

Re: [SQL] Case in-sensitive

2002-07-24 Thread Christopher Kings-Lynne
> Can I config the Postgresql so that it can match case > in-sensitive pattern > automatically? i.e. I don't need to explicit convert the pattern to lower > case like this: .WHERE lower(textfield) LIKE lower(pattern) All you need to do is this: ..WHERE textfield ILIKE pattern Chris --

[SQL] convert a bigint into a timestamp

2002-07-24 Thread marc sturm
Hello, Does anyone know how to convert a bigint into a date or timestamp in a SQL query. Thanks a lot. Marc __ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com ---(end of broadcast)--

Re: [SQL] Trying to write a function...

2002-07-24 Thread Josh Berkus
Wim, > CREATE FUNCTION f_addrtr (varchar(16),varchar(32)) RETURNS bool AS ' > DECLARE > index int4; > BEGIN > index := 'nextval('s_routerid')'; > INSERT INTO t_routers VALUES (index, $1, $2); > RETURN 1; > END;' > LANGUAGE 'plpgsql'; > > What am I doing wrong? Bad quotes, bad data type usage.

Re: [SQL] Problem with my query whithout double-quotes

2002-07-24 Thread Stephan Szabo
On Wed, 24 Jul 2002, ROUWEZ Stephane wrote: > Hi, > My pgsql runs on WinNT Server 4. When I try to > SELECT nom, prenom FROM individu WHERE numero=2 > I have : ERROR: Relation "individu" does not exist > It only works if I write : > SELECT "Individu"."Nom","Individu"."Prenom" FROM "Individu" WHER

Re: RES: RES: [SQL] Queries not using Index

2002-07-24 Thread Tom Lane
Elielson Fontanezi <[EMAIL PROTECTED]> writes: > Hum... What such thing strange. > Hash algorithms should be better than BTREE and RTREE algorithms. Perhaps. The problem with Postgres' hash indexes is that no one has worked on the hash-index code since Berkeley days (except for one or two minor

[SQL] Trying to write a function...

2002-07-24 Thread Wim
Hello, I'm trying to write a function that add new rows to a table, but I don't succeed. It's something like this: CREATE FUNCTION f_addrtr (varchar(16),varchar(32)) RETURNS bool AS ' DECLARE index int4; BEGIN index := 'nextval('s_routerid')'; INSERT INTO t_routers VALUES (index, $1, $2); R

Re: [SQL] Last record

2002-07-24 Thread Chris Ruprecht
Select * from where <...> desc limit 1; Desc = from the bottom up, limit 1 = just one record. Best regards, Chris On Wednesday 24 July 2002 10:36 am, Leao Torre do Vale wrote: > Dear Sir, > > If you already have the answer of the question below please, send to me. > > Best Regards > > Leao > >

Re: [SQL] Last record

2002-07-24 Thread Jan Wieck
Leao Torre do Vale wrote: > How can select one field of last > record of table? There is no such thing as the "last record of a table" in SQL. Somehow you must be able to describe what you mean with "last record" and how to identify that. This would then be translated into a qualification (WHERE

[SQL] Case in-sensitive

2002-07-24 Thread Carmen Wai
Hello: Can I config the Postgresql so that it can match case in-sensitive pattern automatically? i.e. I don't need to explicit convert the pattern to lower case like this: .WHERE lower(textfield) LIKE lower(pattern) Thanks a lot! Carmen ___

[SQL] No command history in psql

2002-07-24 Thread Carmen Wai
Hello: I am upgrading to postgresql version 7.2.1. I found that the psql has not included the readline library automatically and doesn't have any readline and history command function. So I configure the postgresql with option --with-includes=/usr/local/include and --with-libs=/usr/libs/ so th

Re: [SQL] Scan SQL

2002-07-24 Thread Sandro Joel Eller
Josh The good, will be, see the sample below, return field list and table list of the sql and to analyse it to give permission or not to open the table in delphi. select a, b, c, d from z, x Sandro - Original Message - From: "Josh Berkus" <[EMAIL PROTECTED]> To: "Sandro Joel Eller" <[E

Re: [SQL] Queries not using Index

2002-07-24 Thread Daryl Herzmann
Hi! Thanks for your help! On Tue, 23 Jul 2002, Gaetano Mendola wrote: >"Daryl Herzmann" <[EMAIL PROTECTED]> wrote: >> snet=# select count(valid) from t2002_06; >> count >> - >> 1513895 > >> snet=# explain SELECT * from t2002_06 WHERE station = 'SGLI4'; >> NOTICE: QUERY PLAN: >> >

[SQL] Return Primary Key from Procedure

2002-07-24 Thread Peter Atkins
All, I have two tables t_proj, t_task see below: CREATE TABLE t_proj ( proj_id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (proj_id), task_id integer(12), user_id integer(6), title varchar(35), description varchar(80) ); CREATE TABLE t_task ( task_id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (task_

Re: RES: [SQL] Queries not using Index

2002-07-24 Thread Phil Davey
On Wed, 24 Jul 2002, Daryl Herzmann wrote: [lots of chopping and rearranging...] > snet=# explain analyze select * from t2002_06 WHERE station = 'SAMI4'; > Seq Scan on t2002_06 (cost=0.00..35379.69) > Total runtime: 2452.14 msec > > snet=# set enable_seqscan=off; > snet=# explain analyze select *

[SQL] Last record

2002-07-24 Thread Leao Torre do Vale
Dear Sir,   If you already have the answer of the question below please, send to me.   Best Regards   Leao   Maputo - Mozambique   How can select one field of lastrecord of table?(ex: SELECT LAST )Thanks

[SQL] Problem with my query whithout double-quotes

2002-07-24 Thread ROUWEZ Stephane
Hi, My pgsql runs on WinNT Server 4. When I try to SELECT nom, prenom FROM individu WHERE numero=2 I have : ERROR: Relation "individu" does not exist It only works if I write : SELECT "Individu"."Nom","Individu"."Prenom" FROM "Individu" WHERE "Individu"."NumIndiv"=2 Can someone help me ? Th

[SQL] Readline ... a lot of problems...

2002-07-24 Thread Victor Hugo Germano
Hello. I'am Victor, from Brazil. I'am have a problem with postgresql. I can't use the libreadline and i don't know why. It is not working more. What kinds of flags have i put on configure script? how can i know what's the problem? Thanks a lot for your ate

RES: RES: [SQL] Queries not using Index

2002-07-24 Thread Elielson Fontanezi
Hum... What such thing strange. Hash algorithms should be better than BTREE and RTREE algorithms. It is a very interisting thing an postgres, isnt't? Sorry by my useless help. > -Mensagem original- > De: Daryl Herzmann [mailto:[EMAIL PROTECTED]] > Enviada em: quarta-feira, 24 de julho de

Re: [SQL] Queries not using Index

2002-07-24 Thread Christopher Kings-Lynne
> This SELECT causes a sequention scan 'cause your index > is not HASH type, but likely a BTREE one. > BTREE index is to interval searches (station = 'SAMI4%') > not precise searchs. (station = 'SAMI4'). In Postgres, the hash index is slow and inefficient (it's a bit better in7.3), and I believe

Re: RES: [SQL] Queries not using Index

2002-07-24 Thread Daryl Herzmann
Hi! Thanks for the help. Please see my responses below. On Wed, 24 Jul 2002, Elielson Fontanezi wrote: > What kind of index is t2002_06_station_idx? snet=# select indexdef from pg_indexes where indexname='t2002_06_station_idx'; indexdef

Re: [GENERAL] RES: [SQL] Queries not using Index

2002-07-24 Thread Stephan Szabo
On Wed, 24 Jul 2002, Elielson Fontanezi wrote: > Hi! > > What kind of index is t2002_06_station_idx? > Have you done this SELECT command below, right? > > select * from t2002_06 WHERE station = 'SAMI4'; > > This SELECT causes a sequention scan 'cause your index > is not H

RES: [SQL] Queries not using Index

2002-07-24 Thread Elielson Fontanezi
Hi! What kind of index is t2002_06_station_idx? Have you done this SELECT command below, right? select * from t2002_06 WHERE station = 'SAMI4'; This SELECT causes a sequention scan 'cause your index is not HASH type, but likely a BTREE one. BTREE index is

[SQL] pg_restore vs. indexes

2002-07-24 Thread daq
Hi all! I try dump and restore my database, but i got some trouble with indexes. I dumped my database with pg_dump: pg_dump --format c --file=/home/postgres/bydump byenet After this i try to restore the db: pg_restore -c -d byprb /home/postgres/bydump pg_restore: [archiver (db)] could not execu

Re: [SQL] pg_dump and sequences

2002-07-24 Thread Achilleus Mantzios
On Wed, 24 Jul 2002, Tom Lane wrote: > Achilleus Mantzios <[EMAIL PROTECTED]> writes: > >> It seems that pg_dump -t "tablename" dumps correctly the sequence of a > >> table's column,when the column is named after "id". > > > I meant "when ONLY" the column is named after "id", > > Yeah, you're

Re: [SQL] FATAL 1

2002-07-24 Thread Ian Cass
>From /var/log/syslog Jul 22 13:27:28 judas postgres[31058]: [10] DEBUG: connection: host=192.168.6.4 user=postgres database=master Jul 22 14:08:30 judas postgres[31183]: [10] DEBUG: connection: host=192.168.6.4 user=postgres database=master Jul 22 14:08:30 judas postgres[31183]: [11] FATAL 1:

Re: [SQL] pg_dump and sequences

2002-07-24 Thread Tom Lane
Achilleus Mantzios <[EMAIL PROTECTED]> writes: >> It seems that pg_dump -t "tablename" dumps correctly the sequence of a >> table's column,when the column is named after "id". > I meant "when ONLY" the column is named after "id", Yeah, you're right. I'm hoping to see a better answer in 7.3, bu