[SQL] update from and left join

2007-04-11 Thread Tomasz Myrta
Hello I have a query: update A set... from B left join C on (C.col1=B.col1 and C.col2=A.col2) where ... which gives me an error: ERROR: invalid reference to FROM-clause entry for table "A" HINT: There is an entry for table "A", but it cannot be referenced from this part of the query. I fo

Re: [SQL] A long-running transaction

2007-04-11 Thread Andrew Sullivan
On Wed, Apr 11, 2007 at 05:54:45AM +0800, John Summerfield wrote: > Linux caches writes, I don't think it should be hitting disk at all. The I _sure hope_ you don't care about this data, then. That's not a real safe way to work. But. . . > table being updated contains records 7482 (658K raw dat

Re: [SQL] A long-running transaction

2007-04-11 Thread John Summerfield
Andrew Sullivan wrote: On Wed, Apr 11, 2007 at 05:54:45AM +0800, John Summerfield wrote: Linux caches writes, I don't think it should be hitting disk at all. The I _sure hope_ you don't care about this data, then. That's not a real safe way to work. But. . . As I said in the first place, t

Re: [SQL] A long-running transaction

2007-04-11 Thread Andrew Sullivan
On Wed, Apr 11, 2007 at 10:23:34PM +0800, John Summerfield wrote: > Each row's identified by a key, and the key doesn't change. That doesn't matter. > ADABAS would put the updated record right back where it came from, it That isn't how PostgreSQL works. I'm having a hard time laying my hands on

[SQL] Urgent help in bit_string data type

2007-04-11 Thread Karthikeyan Sundaram
Hi Gurus, I have a table with datatype as bitstrings create table test_a (b bit(3)); insert into test_a values ('111'); This will convert a bit to a number == select to_number((substring(b,1,1)::int),9)+3 from test_a; How will I convert a Number to a bit --

Re: [SQL] Urgent help in bit_string data type

2007-04-11 Thread Joe
Hi skarthi, On Wed, 2007-04-11 at 13:30 -0700, Karthikeyan Sundaram wrote: > insert into test_a values (to_char(1,'9')); > > ERROR: column "b" is of type bit but expression is of type > text > HINT: You will need to rewrite or cast the expression. As su

Re: [ADMIN] [SQL] Urgent help in bit_string data type

2007-04-11 Thread Karthikeyan Sundaram
Thanks Joe, Here is my next question. create table test_a (b bit(3)); create view test_vw (b1, b2, b3)as select to_number(substring(b,1,1)::int,'9') as b1,to_number(substring(b,2,1)::int,'9') as b2,to_number(substring(b,3,1)::int,'9') as b3 from test_a;create or replace rule test_a_ins as

Re: [ADMIN] [SQL] Urgent help in bit_string data type

2007-04-11 Thread Joe
Hi skarthi, On Wed, 2007-04-11 at 15:01 -0700, Karthikeyan Sundaram wrote: > create table test_a (b bit(3)); > > create view test_vw (b1, b2, b3) > as select > to_number(substring(b,1,1)::int,'9') as b1, > to_number(substring(b,2,1)::int,'9') as b2, > to_number(substring(b,3,1)::int,'9') as b3 f

Re: [ADMIN] [SQL] Urgent help in bit_string data type

2007-04-11 Thread Karthikeyan Sundaram
Joe, The reason why I am asking is, we are building an interface layer where all our users will have a view. They shouldn't know anything about how and where the data is stored in the table. They can be seen only by the portal which will use view. That's the reason. Regards skarth

Re: [ADMIN] [SQL] Urgent help in bit_string data type

2007-04-11 Thread Joe
Hi skarthi, On Wed, 2007-04-11 at 16:29 -0700, Karthikeyan Sundaram wrote: > The reason why I am asking is, we are building an interface layer > where all our users will have a view. They shouldn't know anything > about how and where the data is stored in the table. They can be seen > only by

[SQL] Replace string

2007-04-11 Thread PostgreSQL Admin
Hi, I want to replace a title with dashes and also remove punctuation. e.g, The blue fox's fur. -> The-blue-fox-fur Thanks for any input, J ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate su

Re: [SQL] Replace string

2007-04-11 Thread A. Kretschmer
am Tue, dem 10.04.2007, um 16:40:41 -0400 mailte PostgreSQL Admin folgendes: > Hi, > > I want to replace a title with dashes and also remove punctuation. > > e.g, The blue fox's fur. -> The-blue-fox-fur test=*# select regexp_replace(regexp_replace('The blue fox\'s fur.', ' ', '-', 'g'), '\\.

Re: [SQL] Replace string

2007-04-11 Thread Rodrigo De León
On 4/10/07, PostgreSQL Admin <[EMAIL PROTECTED]> wrote: Hi, I want to replace a title with dashes and also remove punctuation. e.g, The blue fox's fur. -> The-blue-fox-fur Thanks for any input, J SELECT translate('The blue fox''s fur.', ' .''', '-') ---(end of broa