Re: [SQL] postgresql multiple insert slow

2004-06-06 Thread Harald Fuchs
In article [EMAIL PROTECTED], Michael L. Hostbaek [EMAIL PROTECTED] writes: Hello, I've got a table in an oracle database with approx. 10 records, that I'd like to put into a table in a postgresql database. (This should be done a couple of times per week) I have written a short perl

[SQL] Formatting problems with negative intervals, TO_CHAR

2004-06-06 Thread Jeff Boes
This seems ... well, counter-intuitive at least: (using Pg 7.4.1) # select to_char('4 minutes'::interval - '5 minutes 30 seconds'::interval, 'mi:ss'); to_char - -1:-3 (1 row) Why is the trailing zero lost? Why are there two minus signs? I would expect '-1:30'. Likewise, # select

[SQL] SQL DDL: FOREIGN KEY construct and field mapping: unexpected behavior

2004-06-06 Thread Neil Zanella
Hello, Consider the following code run under PostgreSQL 7.3.4: CREATE TABLE X ( A INT, B INT, PRIMARY KEY (A, B) ); CREATE TABLE Y ( A INT, B INT, C INT, PRIMARY KEY (C), FOREIGN KEY (B, A) REFERENCES X ); INSERT INTO X (A, B) VALUES (1, 2); INSERT INTO Y (A, B, C) VALUES (1,

Re: [SQL] SQL DDL: FOREIGN KEY construct and field mapping: unexpected behavior

2004-06-06 Thread Tom Lane
[EMAIL PROTECTED] (Neil Zanella) writes: CREATE TABLE X ( A INT, B INT, PRIMARY KEY (A, B) ); CREATE TABLE Y ( A INT, B INT, C INT, PRIMARY KEY (C), FOREIGN KEY (B, A) REFERENCES X ); whereas I was expecting the database server to match the names as in: Why were you

Re: [SQL] Formatting problems with negative intervals, TO_CHAR

2004-06-06 Thread Tom Lane
Jeff Boes [EMAIL PROTECTED] writes: This seems ... well, counter-intuitive at least: (using Pg 7.4.1) # select to_char('4 minutes'::interval - '5 minutes 30 seconds'::interval, 'mi:ss'); to_char - -1:-3 (1 row) Why is the trailing zero lost? Why are there two minus signs?

Re: [SQL] ERROR: duplicate key violates unique constraint (SOLVED)

2004-06-06 Thread Khairul Azmi
The problem is solved. It is a silly mistake actually. The line SELECT sid FROM conf_category WHERE category_name like temp_category and category_status=1; returns duplicated values. Variable temp_category would be '%dos.rules' and there are entries 'dos.rules' and 'ddos.rules' in

Re: [SQL] User defined types -- Social Security number...

2004-06-06 Thread Christopher Browne
In the last exciting episode, Greg Patnude [EMAIL PROTECTED] wrote: Thanks Josh -- I understand that there are valid and invalid SSN's -- similar rules apply to zip codes and area codes... I tried this: SELECT to_char(123456789, '000-00-'); which yields 123-45-6789 -- nicely, I might