thanks igor, the combination of regexp_replace and string_agg works great for
me.
the query runs a lot faster than my previous solution and is way easier to
grasp.
Anfang der weitergeleiteten Nachricht:
> Von: Igor Romanchenko
> Betreff: Aw: [SQL] replace text occurrences loaded from
> -Original Message-
> From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-
> ow...@postgresql.org] On Behalf Of jan zimmek
> Sent: Tuesday, October 30, 2012 7:45 AM
> To: pgsql-sql@postgresql.org
> Subject: [SQL] replace text occurrences loaded from table
>
> h
hello,
i am actually trying to replace all occurences in a text column with some
value, but the occurrences to replace are defined in a table. this is a
simplified version of my schema:
create temporary table tmp_vars as select var from
(values('ABC'),('XYZ'),('VAR123')) entries (var);
create
Tony Capobianco wrote:
We are converting from Oracle to Postgres. An Oracle script contains
this line:
select replace(firstname,'"'), memberid, emailaddress from members;
in an effort to replace the " with nothing. How can I achieve the same
result with Postgres?
Here's the Postgres error
On Wednesday 11 May 2011 23:25:34 Ross J. Reedstrom wrote:
> On Wed, May 11, 2011 at 11:11:07PM +0200, Leif Biberg Kristensen wrote:
> > although it's a little above me why you would want to select firstname in
> > the first place when you proceed to replace it with nothing.
>
> Nah, he's replacin
On Wed, May 11, 2011 at 11:11:07PM +0200, Leif Biberg Kristensen wrote:
>
> although it's a little above me why you would want to select firstname in the
> first place when you proceed to replace it with nothing.
Nah, he's replacing double-quote-character " with nothing.
An attempt to protect a
On Wed, May 11, 2011 at 04:51:05PM -0400, Tony Capobianco wrote:
> Ok, I think I found it:
>
> select translate(firstname,'"','') from members;
>
> gives me what I want.
Yup, you beat me to the answer. For the archives, if this was a
compatability question (for example, you've got framework code
On Wednesday 11 May 2011 22:29:40 Tony Capobianco wrote:
> We are converting from Oracle to Postgres. An Oracle script contains
> this line:
>
> select replace(firstname,'"'), memberid, emailaddress from members;
>
> in an effort to replace the " with nothing. How can I achieve the same
> resu
Ok, I think I found it:
select translate(firstname,'"','') from members;
gives me what I want.
Thanks.
On Wed, 2011-05-11 at 16:29 -0400, Tony Capobianco wrote:
> We are converting from Oracle to Postgres. An Oracle script contains
> this line:
>
> select replace(firstname,'"'), memberid, em
We are converting from Oracle to Postgres. An Oracle script contains
this line:
select replace(firstname,'"'), memberid, emailaddress from members;
in an effort to replace the " with nothing. How can I achieve the same
result with Postgres?
Here's the Postgres error I get:
select replace(fir
Hi everybody,
I have the following 3 tables:
sent_messages
uid | receiver| theme| date
-+--+-+---
1 | +40741775630 | CAND1 | 2007-06-12 14:06:57.843024+00
2 | +40741775630 | MAMA | 2007-06-12 14:07:
test=*# select regexp_replace(regexp_replace('The blue fox\'s fur.', ' ', '-',
'g'), '\\.', '');
regexp_replace
The-blue-fox's-fur
(1 row)
Andreas
Thanks for the input.
I came up with this:
REPLACE(regexp_replace('The blue fox\'s fur', '[[:punct:]]', ''), ' ',
The following construct does what I need but is there a better way of
expressing this?
select * from
(
SELECT DISTINCT
section.section_pk
FROM ITEM
LEFT JOIN product product ON Item.product_fk = product.product_pk
LEFT JOIN section section ON product.section_fk = section.section_pk
WHERE i
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
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'), '\\.
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
thanks
If I don't find some other solution, I'll do it .
so, thanks ...
best regards
Kornelije
On Wed, 19 May 2004, BenLaKnet wrote:
> I try to reencode postgresql db ... all is running ... in your shell :
>
> - pg_dump db -f fileout
>
> - iconv fileout i do not remember paramete
Thank you very much, but the database I'm using is not mine
that's why I cannot change anything
If I wont manage to write this replace function, I'll probably use this
solution ...
so thank you
best regards
R. K.
On Wed, 19 May 2004, [ISO-8859-1] Benoît BOURNON wrote:
> I try to r
I try to reencode postgresql db ... all is running ... in your shell :
- pg_dump db -f fileout
- iconv fileout i do not remember parameters but iconv converts the
file.
- createdb db -U unicode (for example)
- pgsql db < fileout_converted
We change previous year the encoding of this webs
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
> I need to write a function which has to replace a character with two or three other
> characters
>
You can use the replace function as specified below:
replace(string text, from text, to text) text
Replace all occurrences in @string of substr
Hi,
I need to write a function which has to replace a
character with two or three other characters
I have some data in the DB and when I retrieve this
data, I have sorting problems because I use specific Croatian characters
I know that the DB is not setup properly, but I
cannot
LK
I'm using Foxpro 8 and I'm trying to merge selective data from 4 different
tables into a new table.The problem is that the tables are not alike, Table one
may have 4 records with the name John in them, table 2 had only one John with
one account # in that record, so I want to have a new table wi
Stephan Szabo <[EMAIL PROTECTED]> writes:
> Coalesce((select max(pos)+1 from tab2), 0)
> should work.
Small comment: it's probably noticeably faster to do
(select Coalesce(max(pos), 0) +1 from tab2)
I think that the former will result in two evaluations of the sub-select
in the typical c
On Wed, 16 Oct 2002, Albrecht Berger wrote:
> Hello,
> I have a statement like this :
>
> INSERT INTO tab1 (c1, c2, c3) VALUES (1,2, SELECT MAX(pos)+1 FROM tab2);
Coalesce is your friend. :)
Coalesce((select max(pos)+1 from tab2), 0)
should work.
---(end of broadcast)
On Wednesday 16 October 2002 12:07, Albrecht Berger wrote:
> Hello,
> I have a statement like this :
>
> INSERT INTO tab1 (c1, c2, c3) VALUES (1,2, SELECT MAX(pos)+1 FROM tab2);
>
> This works fine if the subselect returns a value, but if it returns
> null there is a problem. In this case a 0 has
Hello,
I have a statement like this :
INSERT INTO tab1 (c1, c2, c3) VALUES (1,2, SELECT MAX(pos)+1 FROM tab2);
This works fine if the subselect returns a value, but if it returns
null there is a problem. In this case a 0 has to be inserted.
Is there any pg function which solves this problem ?
I
"Diehl, Jeffrey" <[EMAIL PROTECTED]> writes:
> I'm in the process of migrating a database and application suite from mysql
> to postgresql. The problem is that I've used
> mysql's "replace into..." quite frequently...
> Does anyone know of a "clean" way to implement this feature in postgresql?
>
Diehl, Jeffrey writes:
> I'm in the process of migrating a database and application suite from mysql
> to postgresql. The problem is that I've used
> mysql's "replace into..." quite frequently...
begin transaction;
update ...
insert ...
commit;
or some permutation thereof. If you need to
On Tue, 19 Dec 2000, Bruno Boettcher wrote:
> actually i look up if the corresponding entry exists (comparing
> user-name and field-name) if yes i update, if no i insert
>
> this isn't very appealing, but i couldn't find another way yet to make
> this shorter...
>
> would be nice if something
hello,
i have the following problem:
i have in php an array structure with user-prefs that have to be stored
onto DB
actually i look up if the corresponding entry exists (comparing
user-name and field-name) if yes i update, if no i insert
this isn't very appealing, but i couldn't find a
30 matches
Mail list logo