[SQL] Need to do an ALTER TABLE.

2001-04-04 Thread jkakar
Hi, I've got a live database running PSQL 7.0.3. I need to do a couple of changes to some of the table schema's but need to preserve the data that currently exists in the tables. I've used pg_dump to make backups and have verified that I can indeed restore into an empty database from those back

[SQL] serial type; race conditions

2001-03-26 Thread jkakar
Hi, I'm using serial fields to generate IDs for almost all object in my database. I insert an empty row, get the CURRVAL() of the sequence and then update to that value. I had understood (and now, I can't find the reference to back this up) that serial is implemented in such a way that race con

[SQL] Re: Normalization is always good?

2001-03-15 Thread jkakar
Hi Josh, > normal form, most of the time. And I do a few things (such as > polymorhic sub-tables) that would give Fabian Pascal fits :-) Polymorphic sub-tables? =) Do you mean using, for example, one user table that stores different types of users and has some fields specific to only some kinds

[SQL] timestamp- milliseconds since epoch output

2001-02-06 Thread jkakar
Hi, I'm using a timestamp field called date_created. Whenever I select it I get: select date_created from tbl_user; date_created 2001-02-05 17:23:26-08 2001-02-05 17:45:39-08 2001-02-03 03:58:53-08 (3 rows) I've tried using variations of to_char and to_t

[SQL] Automated scripting...

2001-01-30 Thread jkakar
Hi, I'm building a script to create a relatively large database. At some point in the script I would like to be able to save values into variables so that I can use them to populate rows. Is this possible with SQL? My understanding is that it is not possible but thought I'd ask anyway. Thanks

[SQL] Weird script problems solved...

2001-01-15 Thread jkakar
Hi, About a week back I'd posted a message asking for help with a script that as far as I could tell was well formed. The problem was with 2 INSERT statements directly after the CREATE TABLE statement of the table that I was trying to insert data into. I'd used C single/multi line comments of t

[SQL] Weird problem with script...

2001-01-02 Thread jkakar
Hi, I'm building a script to create the tables in my database. Everything works fine except one thing with this part of my script: create table tbl_resume_free_text_type ( type_id int, type text ); -- insert into tbl_resume_free_text_type (type_id, type) values (1, 'Hobbies');

[SQL] How to trim values?

2000-12-28 Thread jkakar
Hi, I'm trying to figure out how to take a value like 3.68009074974387 (that is calculated from values in my database) and have PostgreSQL hand me 3.68. Any suggestions would be appreciated. Thanks, Jamu. -- Jamu Kakar (Developer) Expressus Design Studio, Inc. [EMAIL PROTECTE

[SQL] Bounds checking on an alias

2000-12-18 Thread jkakar
Hi, Removing the double single-quotes from the distance function fixed the problem, thanks. I've now encountered another problem... I have the following (ugly) query: SELECT DISTINCT tbl_restaurant.restaurant, tbl_restaurant_location.postal_code, tbl_restaurant_location.latitude AS latitude, t

[SQL] Problem with function...

2000-12-18 Thread jkakar
Hi, I hope my question is appropriate for this list. I'm trying to create a function that calculates the distance between a pair of latitude/longitude points. This is what I have: /* latlon_distance.pgsql * by Jamu Kakar <[EMAIL PROTECTED]>, Dec 18, 2000. * * Calculates the distance between