Re: [SQL] RTREE on points

2001-04-16 Thread Julian Scarfe
Julian Scarfe wrote: > > > > explain select * from nodes where box(node,node) @ '((1,1),(3,3))'::box; > > NOTICE: QUERY PLAN: > > Seq Scan on nodes (cost=0.00..1.10 rows=1 width=28) From: "Jeff Hoffmann" <[EMAIL PROTECTED]> > this should work, assuming you have enough points to make a differen

[SQL] Cursors in plpgsql

2001-04-16 Thread Preeti Kamble
Hi Is there a command in plpgsql similar to %NOTFOUND of oracle? i want to write a load script which takes each row from the temporary table, do some processing and insert into actual tables. Any idea how i can accomplish this??? thank you regards Preeti ---(end of bro

[SQL] Re: Using Random Sequence as Key

2001-04-16 Thread Bernardo de Barros Franco
It is a good way to solve it but since I don't want/can't use cookies in my application I could use only the random key but it would have to be unique or the where key=$key could refer to multiple lines or I would have to ask for the user to input both the random and the serial number wich wouldn'

[SQL] Re: Using Random Sequence as Key

2001-04-16 Thread Bernardo de Barros Franco
Since I can't really redesign my application, I could index the table using a serial but still would need a field with the random and unique number. I tried using including a unique in : create table test (id int UNIQUE default random() * 8 + 1, content text); and it didn't return any erro

Re: [SQL] Using Random Sequence as Key

2001-04-16 Thread Bernardo de Barros Franco
Thank you it was pretty much something like that. I need to make a sale table but the sale code is a random number. Since it is going to be used in all queries and it is unique, it might as well be my table key (index). I could make a index and other field to be the sale code but then I would h

Re: [SQL] RTREE on points

2001-04-16 Thread Tom Lane
Jeff Hoffmann <[EMAIL PROTECTED]> writes: > yes, it does seem like a little more work, but there doesn't seem to be > a lot of usage of the geometric functions by the developers to look at > missing features -- they're mostly just reactive to problems. Jeff's correct, none of the core developers

Re: [SQL] RTREE on points

2001-04-16 Thread Jeff Hoffmann
Julian Scarfe wrote: > > It hadn't occured to me that the index would simply not be used and I'm > grateful for the pointer to the appropriate variable. i wouldn't recommend turning off sequential scans for day-to-day usage, but it certainly can be useful for debugging and testing. if you have

[SQL] Using Random Sequence as Key

2001-04-16 Thread Dan Lyke
Bernardo de Barros Franco writes: > Hello, I was wondering if noone can help me maybe someone could at least > give me some directions where to look for info or where to ask: > I wanted to index a table by a random key. As others have pointed out, making a unique random primary key is tough. What

Re: [SQL] Range of Serial values

2001-04-16 Thread cbell
Thank you Poul and Justin, I'll give it a try!!! ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] Range of Serial values

2001-04-16 Thread Justin Clift
Hi, I believe you could also create the sequence, then update it with setval('', ); Regards and best wishes, Justin Clift "Poul L. Christiansen" wrote: > > Yes, there is. > > When you create a serial column a sequence is created, which does the > counting. > > You can create a serial column

Re: [SQL] Using Random Sequence as Key

2001-04-16 Thread Roberto Mello
On Sun, Apr 15, 2001 at 10:58:40PM -0300, Bernardo de Barros Franco wrote: > I wanted to index a table by a random key. Exemplifying, when a insert is > made, the id value is automatically filled with a random number between > 1 and 9. I'm pretty new in pgsql so I could use a howto or

[SQL] Range of Serial values

2001-04-16 Thread cbell
Hello everyone, when creating a serial column, is there a way to specify which number it will start counting from? For example, if you wanted all Serial ID's to start at 1000 and count up from there, with no numbers below that. Thanks, Chris. ---(end of broadcast)-

[SQL] RULE ... TO table.column

2001-04-16 Thread Albert REINER
Saluton, I am using , | SELECT version(); | version | | PostgreSQL 7.0.2 on i586-pc-linux-gnulibc1, compiled by gcc 2.95.1 | (1 row) ` , and upgrading to 7.1 is not possible (it was hard

Re: [SQL] Range of Serial values

2001-04-16 Thread Poul L. Christiansen
Yes, there is. When you create a serial column a sequence is created, which does the counting. You can create a serial column, drop the associated sequence and create a new one with the command: "CREATE SEQUENCE seqname START 1000". See also "\h CREATE SEQUENCE". HTH, Poul L. Christansen cbel

Re: [SQL] Using Random Sequence as Key

2001-04-16 Thread Peter Eisentraut
Bernardo de Barros Franco writes: > But my only question would be, in the example quoted would id be really the > table index and is it unique? Making unique *and* random numbers is a pretty complex (and slow) thing to do in general. Consider redesigning your application. > > Thank you > > Quo

Re: [SQL] RTREE on points

2001-04-16 Thread Jeff Hoffmann
Julian Scarfe wrote: > > explain select * from nodes where box(node,node) @ '((1,1),(3,3))'::box; > NOTICE: QUERY PLAN: > Seq Scan on nodes (cost=0.00..1.10 rows=1 width=28) > this should work, assuming you have enough points to make a difference (in the optimizer's mind, at least). the opti

Re: [SQL] Using Random Sequence as Key

2001-04-16 Thread Peter Eisentraut
Bernardo de Barros Franco writes: > I wanted to index a table by a random key. Exemplifying, when a insert is > made, the id value is automatically filled with a random number between > 1 and 9. => create table test (id int default random() * 8 + 1, content text); CREATE => inser

[SQL] Using Random Sequence as Key

2001-04-16 Thread Bernardo de Barros Franco
Hello, I was wondering if noone can help me maybe someone could at least give me some directions where to look for info or where to ask: I wanted to index a table by a random key. Exemplifying, when a insert is made, the id value is automatically filled with a random number between 1 and 9

Re: [SQL] Same question about PostgreSql

2001-04-16 Thread Johannes Grødem
> More than Interbase :-) More than MS SQL Server. Maybe less than > Oracle or MySQL; it's open to debate. Um. In my experience, PostgreSQL is more stable than MySQL. MySQL dies on me all the time, but I've never had it happen with PostgreSQL. (7.0.3, currently.) -- johs --