pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: [SQL] Update on 6.5
4+ messages / 2 participants
[nested] [flat]
* Update on 6.5
@ 1999-04-16 15:47 Chairudin Sentosa <chairudin@prima.net.id>
1999-04-16 13:28 ` Re: [SQL] Update on 6.5 José Soares <jose@sferacarta.com>
0 siblings, 1 reply; 4+ messages in thread
From: Chairudin Sentosa @ 1999-04-16 15:47 UTC (permalink / raw)
To: ; +Cc: pgsql-sql
Hi,
I am using postgresql 6.5 snapshot.
I can not update.
Could anyone tell me what's wrong, please?
update ibs_br_all_total_units tr set first_name=
(select first_name from ibs_subscriber tn
where tr.pin = tn.pin
);
"/tmp/psql.60000.13342" 4 lines, 117 characters
ERROR: parser: syntax error at or near "tr"
Thanks.
Regards,
Chai
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [SQL] Update on 6.5
1999-04-16 15:47 Update on 6.5 Chairudin Sentosa <chairudin@prima.net.id>
@ 1999-04-16 13:28 ` José Soares <jose@sferacarta.com>
1999-04-21 08:36 ` Re: [SQL] Update on 6.5 Chairudin Sentosa <chairudin@prima.net.id>
0 siblings, 1 reply; 4+ messages in thread
From: José Soares @ 1999-04-16 13:28 UTC (permalink / raw)
To: chairudin@prima.net.id; +Cc: pgsql-sql
Chairudin Sentosa ha scritto:
> Hi,
>
> I am using postgresql 6.5 snapshot.
> I can not update.
> Could anyone tell me what's wrong, please?
>
> update ibs_br_all_total_units tr set first_name=
> (select first_name from ibs_subscriber tn
> where tr.pin = tn.pin
> );
>
> "/tmp/psql.60000.13342" 4 lines, 117 characters
> ERROR: parser: syntax error at or near "tr"
>
AFAIK PostgreSQL doesn't allow subselects on UPDATE.
José
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [SQL] Update on 6.5
1999-04-16 15:47 Update on 6.5 Chairudin Sentosa <chairudin@prima.net.id>
1999-04-16 13:28 ` Re: [SQL] Update on 6.5 José Soares <jose@sferacarta.com>
@ 1999-04-21 08:36 ` Chairudin Sentosa <chairudin@prima.net.id>
1999-04-21 12:39 ` Re: [SQL] Update on 6.5 José Soares <jose@sferacarta.com>
0 siblings, 1 reply; 4+ messages in thread
From: Chairudin Sentosa @ 1999-04-21 08:36 UTC (permalink / raw)
To: José Soares <jose@sferacarta.com>; +Cc: pgsql-sql
José Soares wrote:
> Chairudin Sentosa ha scritto:
>
> > Hi,
> >
> > I am using postgresql 6.5 snapshot.
> > I can not update.
> > Could anyone tell me what's wrong, please?
> >
> > update ibs_br_all_total_units tr set first_name=
> > (select first_name from ibs_subscriber tn
> > where tr.pin = tn.pin
> > );
> >
> > "/tmp/psql.60000.13342" 4 lines, 117 characters
> > ERROR: parser: syntax error at or near "tr"
> >
>
> AFAIK PostgreSQL doesn't allow subselects on UPDATE.
>
> José
Hi Jose,
How should I do it in PostgreSQL?
Thanks
Regards,
Chai
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: [SQL] Update on 6.5
1999-04-16 15:47 Update on 6.5 Chairudin Sentosa <chairudin@prima.net.id>
1999-04-16 13:28 ` Re: [SQL] Update on 6.5 José Soares <jose@sferacarta.com>
1999-04-21 08:36 ` Re: [SQL] Update on 6.5 Chairudin Sentosa <chairudin@prima.net.id>
@ 1999-04-21 12:39 ` José Soares <jose@sferacarta.com>
0 siblings, 0 replies; 4+ messages in thread
From: José Soares @ 1999-04-21 12:39 UTC (permalink / raw)
To: chairudin@prima.net.id; +Cc: pgsql-sql
Try this function:
create function a(int,text) returns text as
'begin
update ibs_br_all_total_units set first_name = $2 where pin =
$1;
RETURN $2;
end; ' language 'plpgsql';
create table ibs_subscriber( pin int, first_name text);
insert into ibs_subscriber values(1,'pippo');
insert into ibs_subscriber values(3,'pluto');
create table ibs_br_all_total_units( pin int, first_name text);
insert into ibs_br_all_total_units values(1,'text');
insert into ibs_br_all_total_units values(2,'text');
insert into ibs_br_all_total_units values(3,'text');
select * from ibs_subscriber ;
pin|first_name
---+----------
1|pippo
3|pluto
(2 rows)
select * from ibs_br_all_total_units ;
pin|first_name
---+----------
1|text
2|text
3|text
(3 rows)
select a(pin,first_name) from ibs_subscriber ;
a
-----
pippo
pluto
(2 rows)
select * from ibs_br_all_total_units ;
pin|first_name
---+----------
2|text
1|pippo
3|pluto
(3 rows)
José
Chairudin Sentosa ha scritto:
> José Soares wrote:
>
> > Chairudin Sentosa ha scritto:
> >
> > > Hi,
> > >
> > > I am using postgresql 6.5 snapshot.
> > > I can not update.
> > > Could anyone tell me what's wrong, please?
> > >
> > > update ibs_br_all_total_units tr set first_name=
> > > (select first_name from ibs_subscriber tn
> > > where tr.pin = tn.pin
> > > );
> > >
> > > "/tmp/psql.60000.13342" 4 lines, 117 characters
> > > ERROR: parser: syntax error at or near "tr"
> > >
> >
> > AFAIK PostgreSQL doesn't allow subselects on UPDATE.
> >
> > José
>
> Hi Jose,
>
> How should I do it in PostgreSQL?
>
> Thanks
>
> Regards,
> Chai
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~1999-04-21 12:39 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-04-16 15:47 Update on 6.5 Chairudin Sentosa <chairudin@prima.net.id>
1999-04-16 13:28 ` José Soares <jose@sferacarta.com>
1999-04-21 08:36 ` Chairudin Sentosa <chairudin@prima.net.id>
1999-04-21 12:39 ` José Soares <jose@sferacarta.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox