[SQL] htdig & postgresql

2002-09-11 Thread Rudi Starcevic
Hi, I'm just about to start nutting out way to use htdig and a Postgress database. I've had a quick look around and can't see much out there already. Anyone had any success's ? I want to index text information in a database and output matches in order of relevance. I plan on build a web interf

Re: [SQL] writing a function to mimic mysql last_insert_id

2002-09-11 Thread Joe Conway
Beth Gatewood wrote: > well, I know that I will have only a single sequence that will generate the > primary key per table. So basically, this type of function, for me needs > only to return the value of the primary key. > > I believe I mentioned in one of my posts the motivation behind not want

Re: [SQL] writing a function to mimic mysql last_insert_id

2002-09-11 Thread Beth Gatewood
well, I know that I will have only a single sequence that will generate the primary key per table. So basically, this type of function, for me needs only to return the value of the primary key. I believe I mentioned in one of my posts the motivation behind not wanting to use currval()...which wa

Re: [SQL] writing a function to mimic mysql last_insert_id

2002-09-11 Thread Chris
Hi Beth, Here's a function I use to do the same sort of thing - but you need to supply it with a table name to get it - in the case of standard inserts it's pretty easy since it's always the third word (so if you're using an abstraction layer it's easy to change). It can be written a lot bett

Re: [SQL] writing a function to mimic mysql last_insert_id

2002-09-11 Thread Christopher Kings-Lynne
But in Postgres, you can have as many "autoincrement" columns in a table as you want - how will you handle that? And what's wrong with select currval()? Chris > I am wondering if I can get some input on the logic that I would need to > code a function that would mimic mysql's last_insert_id()..

[SQL] reset sequence

2002-09-11 Thread Ricardo Javier Aranibar León
Hi List, I need that somebody help me. First, I use PostgreSQL 7.0.3 for linux. I need reset my sequence but that it begin in 1 again when a use nextval. And I have been search in http://archives.postgresql.org/ about reset sequence but I obtain this information: SELECT setval('name_sequence'

Re: [SQL] writing a function to mimic mysql last_insert_id

2002-09-11 Thread Josh Berkus
Beth, > However, we are in the midst of porting a mysql database to pgsql. The perl > application that is tied to this mysql database heavily utilizes > last_insert_id. In an effort to save the perl developers the pain of having > to go in and modify a bunch of their SQL to call out to seq.cur

Re: [SQL] writing a function to mimic mysql last_insert_id

2002-09-11 Thread Beth Gatewood
Josh and Ross- Thanks...I am well aware of currval and sequence use, and for me too this would be the easiest solution ;-) However, we are in the midst of porting a mysql database to pgsql. The perl application that is tied to this mysql database heavily utilizes last_insert_id. In an effort t

Re: [SQL] writing a function to mimic mysql last_insert_id

2002-09-11 Thread Ross J. Reedstrom
Beth - Take a look at pgsql's sequences. They do pretty much exactly what you want, here. There's even a 'pseudo type' serial that sets up an int column with a default value coming from a sequence. Sequences are more loosely couple to 'auto increment' columns than in mysql or other database sys

Re: [SQL] writing a function to mimic mysql last_insert_id

2002-09-11 Thread Josh Berkus
Beth, > I am wondering if I can get some input on the logic that I would need to > code a function that would mimic mysql's last_insert_id().. Um, what about CURRVAL('sequence-name')? -- -Josh Berkus Aglio Database Solutions San Francisco ---(end of broadcast)-

[SQL] writing a function to mimic mysql last_insert_id

2002-09-11 Thread Beth Gatewood
Hi all- I am wondering if I can get some input on the logic that I would need to code a function that would mimic mysql's last_insert_id().. Here is what last_insert_id() does in mysql: Returns the last automatically generated value that was inserted into an AUTO_INCREMENT column. mysql> SELECT