Re: [SQL] date

2006-02-10 Thread Ken Hill
On Fri, 2006-02-10 at 07:38 +0100, A. Kretschmer wrote: am 09.02.2006, um 22:18:09 -0800 mailte superboy143 (sent by Nabble.com) folgendes: > > Hello, > > How can I write an sql query in postgresql so that I can insert a date into > a table in the format DD-MM-, and when I select the d

Re: [SQL] query

2006-02-10 Thread Ken Hill
On Fri, 2006-02-10 at 00:11 -0600, Bruno Wolff III wrote: On Tue, Feb 07, 2006 at 01:45:50 -0800, "superboy143 (sent by Nabble.com)" <[EMAIL PROTECTED]> wrote: > > I have a table in which I have a field with format like 100101. It has many values like 100101, 100102, 100103, 100201, 100202

Re: [SQL] date

2006-02-10 Thread Tom Lane
Ken Hill <[EMAIL PROTECTED]> writes: > On Fri, 2006-02-10 at 07:38 +0100, A. Kretschmer wrote: >> You can't define the format in the db, but you can define the >> output-format with to_char(date, 'DD-MM-'); > You could also try using the data_part() function: Setting the DateStyle parameter m

[SQL] Deleting rows in a file based on condition

2006-02-10 Thread Ken Hill
I have the following perl script that reads a fixed-width file and replaces values in various sections of the file. --- open (IN, '< in.txt'); open (OUT, '> out_test.txt'); while () {   chomp;   $first_section = substr $_, 0, 381;

Re: [SQL] Deleting rows in a file based on condition

2006-02-10 Thread Ken Hill
Oops. I posted this to the wrong support list. Sorry. -Ken On Fri, 2006-02-10 at 09:52 -0800, Ken Hill wrote: I have the following perl script that reads a fixed-width file and replaces values in various sections of the file. --- open

Re: [SQL] date

2006-02-10 Thread Osvaldo Rosário Kussama
superboy143 (sent by Nabble.com) wrote: Hello, How can I write an sql query in postgresql so that I can insert a date into a table in the format DD-MM-, and when I select the date from the table I should get the date in the same format. See postgresql.conf documentation (http://www.pos

[SQL] Very slow updates when using IN syntax subselect

2006-02-10 Thread Bryce Nesbitt
If I do: select event_id from event join token using (token_number) where token_status=50 and reconciled=false limit 1; Then: update event set reconciled=true where event_id={XXX}; It returns in about a second, or less. But If I do the same thing with the IN syntax:

Re: [SQL] unique constraint instead of primary key? what

2006-02-10 Thread Chris Browne
gry@ll.mit.edu (george young) writes: > On 9 Feb 2006 08:22:59 -0800 > "BigSmoke" <[EMAIL PROTECTED]> threw this fish to the penguins: > >> If my tables have one or more UNIQUE constraints/indices, I still add a >> "id SERIAL PRIMARY KEY" field to most of my tables. This makes >> referencing easier

Re: [SQL] Very slow updates when using IN syntax subselect

2006-02-10 Thread Tom Lane
Bryce Nesbitt <[EMAIL PROTECTED]> writes: > update event set reconciled=true where event_id in > (select event_id from event join token using (token_number) > where token_status=50 and reconciled=false LIMIT 1); > On a 4 CPU machine, 2 CPU's peg at 100%, and the request just eats CPU

Re: [SQL] Very slow updates when using IN syntax subselect

2006-02-10 Thread Bryce Nesbitt
Tom Lane wrote: > Bryce Nesbitt <[EMAIL PROTECTED]> writes: > >> update event set reconciled=true where event_id in >> (select event_id from event join token using (token_number) >> where token_status=50 and reconciled=false LIMIT 1); >> >> On a 4 CPU machine, 2 CPU's peg at 10