Thread: BUG #3641: Concat fails in update

BUG #3641: Concat fails in update

From
"Curt"
Date:
The following bug has been logged online:

Bug reference:      3641
Logged by:          Curt
Email address:      kurt@net2business.com
PostgreSQL version: 8.1.9-1.el5
Operating system:   Centos 5
Description:        Concat fails in update
Details:

UPDATE table content=content || 'constant' where idx=101;

Content field is overwritten with 'constant'.

Re: BUG #3641: Concat fails in update

From
Heikki Linnakangas
Date:
Curt wrote:
> The following bug has been logged online:
>
> Bug reference:      3641
> Logged by:          Curt
> Email address:      kurt@net2business.com
> PostgreSQL version: 8.1.9-1.el5
> Operating system:   Centos 5
> Description:        Concat fails in update
> Details:
>
> UPDATE table content=content || 'constant' where idx=101;
>
> Content field is overwritten with 'constant'.

You're missing a SET.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

Re: BUG #3641: Concat fails in update

From
"Milen A. Radev"
Date:
Curt написа:
> The following bug has been logged online:
>
> Bug reference:      3641
> Logged by:          Curt
> Email address:      kurt@net2business.com
> PostgreSQL version: 8.1.9-1.el5
> Operating system:   Centos 5
> Description:        Concat fails in update
> Details:
>
> UPDATE table content=content || 'constant' where idx=101;
>
> Content field is overwritten with 'constant'.


Is this the real statement you've used? Because it's not a valid UPDATE
statement - it's missing the 'SET' part before the name of the column.
Could you send the real statement _and_ the error message you've got.


--
Milen A. Radev

Re: BUG #3641: Concat fails in update

From
"Kevin Grittner"
Date:
>>> On Fri, Sep 28, 2007 at  8:39 AM, in message
<200709281339.l8SDdIxj002744@wwwmaster.postgresql.org>, "Curt"
<kurt@net2business.com> wrote:=20
=20
> UPDATE table content=3Dcontent || 'constant' where idx=3D101;
>=20
> Content field is overwritten with 'constant'.
=20
test=3D> create temp table t1 (idx int not null primary key, content text);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" fo=
r table "t1"
CREATE TABLE
test=3D> insert into t1 values (1, 'one');
INSERT 0 1
test=3D> update t1 set content =3D content || ' and a half' where idx =3D 1;
UPDATE 1
test=3D> select * from t1;
 idx |    content
-----+----------------
   1 | one and a half
(1 row)

test=3D> select version();
                                       version
---------------------------------------------------------------------------=
----------
 PostgreSQL 8.2.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.3 (Su=
SE Linux)
(1 row)
=20
Please show something similar from your environment.
=20
-Kevin
=20