pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
assigning values to array elements
4+ messages / 3 participants
[nested] [flat]

* assigning values to array elements
@ 2003-01-13 20:25  J Greenbaum <jj@bu.edu>
  0 siblings, 1 reply; 4+ messages in thread

From: J Greenbaum @ 2003-01-13 20:25 UTC (permalink / raw)
  To: pgsql-sql

Hello,

I'm fairly new to postgres and I'm trying to write a PL/pgsql function and
keep getting an error message.  Here is the line that is giving me
trouble:

norm[i] := (NEW.area[i]/(A_slope * (i+18) + A_int)+NEW.area[i]/(C_slope *
(i+18) + C_int))/2;

The error message that I receive is: WARNING:  plpgsql: ERROR during
compile of norm_n_scan near line 27 ERROR:  parse error at or near "["

As you can see, I'm trying to assign a value to an array element, but it
isn't working for some reason.  FYI, "norm" is declared as a floating
point array of unlimited size.  Please let me know if you have any
suggestions.  Thanks!!

-Jay Greenbaum

P.S. My apologies for posting this to 2 lists!




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: assigning values to array elements
@ 2003-01-13 21:04  Tom Lane <tgl@sss.pgh.pa.us>
  parent: J Greenbaum <jj@bu.edu>
  0 siblings, 2 replies; 4+ messages in thread

From: Tom Lane @ 2003-01-13 21:04 UTC (permalink / raw)
  To: J Greenbaum <jj@bu.edu>; +Cc: pgsql-sql@postgresql.org, Bruce Momjian <pgman@candle.pha.pa.us>

J Greenbaum <jj@bu.edu> writes:
> As you can see, I'm trying to assign a value to an array element, but it
> isn't working for some reason.

plpgsql doesn't support that yet :-(.

This needs to be fixed.  I'm not sure why it doesn't have an entry in
TODO.  Bruce, would you add something like
	* allow assignment to array elements
to the plpgsql section?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: assigning values to array elements
@ 2003-01-13 21:11  J Greenbaum <jj@bu.edu>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 4+ messages in thread

From: J Greenbaum @ 2003-01-13 21:11 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql@postgresql.org, Bruce Momjian <pgman@candle.pha.pa.us>

Darn...guess I gotta do it in perl then.  Thx for your help.

On Mon, 13 Jan 2003, Tom Lane wrote:

> J Greenbaum <jj@bu.edu> writes:
> > As you can see, I'm trying to assign a value to an array element, but it
> > isn't working for some reason.
> 
> plpgsql doesn't support that yet :-(.
> 
> This needs to be fixed.  I'm not sure why it doesn't have an entry in
> TODO.  Bruce, would you add something like
> 	* allow assignment to array elements
> to the plpgsql section?
> 
> 			regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html
> 




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: assigning values to array elements
@ 2003-01-14 00:47  Bruce Momjian <pgman@candle.pha.pa.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 4+ messages in thread

From: Bruce Momjian @ 2003-01-14 00:47 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: J Greenbaum <jj@bu.edu>; pgsql-sql

Tom Lane wrote:
> J Greenbaum <jj@bu.edu> writes:
> > As you can see, I'm trying to assign a value to an array element, but it
> > isn't working for some reason.
> 
> plpgsql doesn't support that yet :-(.
> 
> This needs to be fixed.  I'm not sure why it doesn't have an entry in
> TODO.  Bruce, would you add something like
> 	* allow assignment to array elements
> to the plpgsql section?

Added to TODO:

        o Allow PL/PgSQL to support array element assignment

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2003-01-14 00:47 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-01-13 20:25 assigning values to array elements J Greenbaum <jj@bu.edu>
2003-01-13 21:04 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-01-13 21:11   ` J Greenbaum <jj@bu.edu>
2003-01-14 00:47   ` Bruce Momjian <pgman@candle.pha.pa.us>

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