Re: [SQL] Arrays, types and prodedures

2008-07-25 Thread Pavel Stehule
hello 2008/7/25 Chris Hoy <[EMAIL PROTECTED]>: > > > Hi > > I am having trouble passing arrays of types to a store procedure > I have the following type > >CREATE TYPE IndexElement AS ( >keyname text, >keytype integer >); > > and the header for the

Re: [SQL] Arrays in PL/pgSQL routines?

2005-12-29 Thread Michael Fuhr
On Thu, Dec 29, 2005 at 01:23:28PM -0500, Ken Winter wrote: > That works. (Odd that the initialization seems to be necessary to make it > work.) Thanks! Yes, I'm using version 7.4. 7.4.what? Absence of initialization shouldn't cause a syntax error; at least it doesn't in 7.4.10. However, in 7

Re: [SQL] Arrays in PL/pgSQL routines?

2005-12-29 Thread Tom Lane
"Ken Winter" <[EMAIL PROTECTED]> writes: > That works. (Odd that the initialization seems to be necessary to make it > work.) Thanks! Yes, I'm using version 7.4. Possibly what you're running into is that 7.4 is restrictive about what you can do with an array that's NULL. Until pretty recently,

Re: [SQL] Arrays in PL/pgSQL routines?

2005-12-29 Thread Ken Winter
: Ken Winter > Cc: PostgreSQL pg-sql list > Subject: Re: [SQL] Arrays in PL/pgSQL routines? > > Ken Winter wrote: > > Can arrays be declared in PL/pgSQL routines? If so, how? > > > > > DECLARE > > > try: > my_array VARCHAR[] := '{}'; > > no

Re: [SQL] Arrays in PL/pgSQL routines?

2005-12-29 Thread Michael Fuhr
On Thu, Dec 29, 2005 at 12:46:28PM -0500, Ken Winter wrote: > Can arrays be declared in PL/pgSQL routines? If so, how? > > Section 8.10 of the documentation > (http://www.postgresql.org/docs/7.4/static/arrays.html) tells how to declare > and use arrays as table columns. But I don't find any part

Re: [SQL] Arrays in PL/pgSQL routines?

2005-12-29 Thread Bricklen Anderson
Ken Winter wrote: Can arrays be declared in PL/pgSQL routines? If so, how? DECLARE try: my_array VARCHAR[] := '{}'; not sure if this works in 7.4 though, if that's the version that you are using. ---(end of broadcast)--- TIP 9: In versio

Re: [SQL] ARRAYs and INDEXes ...

2005-08-16 Thread Greg Stark
"Marc G. Fournier" <[EMAIL PROTECTED]> writes: > SELECT * FROM customers WHERE monthly_balance[6] = 0.00; This, like the other poster said, can be accomplished with a set of simple expression indexes. > As an example ... or > > SELECT * FROM customers WHERE 0.00 = any (monthly_balance); This w

Re: [SQL] ARRAYs and INDEXes ...

2005-08-15 Thread Michael Fuhr
On Tue, Aug 16, 2005 at 01:54:13AM -0300, Marc G. Fournier wrote: > > CREATE TABLE customers ( > customer_id SERIAL, > monthly_balance DECIMAL(7,2)[12] > ); > > Is it possible to create an INDEX on customers.monthly_balance such that I > could do something like: > > SELECT * FROM customers W

Re: [SQL] arrays and polygons

2004-02-13 Thread Joe Conway
Tom Lane wrote: "David" <[EMAIL PROTECTED]> writes: INSERT INTO species (location) VALUES ('{((432,89), (45,87), (89,87)), ((54,78), (34,98))}; I think you'd need to double-quote each polygon within the array literal. '{"((432,89), (45,87), (89,87))", "..."}' The array parser doesn't think parens

Re: [SQL] arrays and polygons

2004-02-13 Thread David
Thanks to you both that helped enormously, Dave - Original Message - From: "Joe Conway" <[EMAIL PROTECTED]> To: "Tom Lane" <[EMAIL PROTECTED]> Cc: "David" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, February 13, 2004

Re: [SQL] arrays and polygons

2004-02-13 Thread Tom Lane
"David" <[EMAIL PROTECTED]> writes: > ALTER TABLE species ADD COLUMN location polygon[]; > INSERT INTO species (location) VALUES ('{((432,89), (45,87), (89,87)), > ((54,78), (34,98))}; I think you'd need to double-quote each polygon within the array literal. '{"((432,89), (45,87), (89,87

Re: [SQL] arrays in pl/pgsql

2003-12-15 Thread Tom Lane
Michael Shapiro <[EMAIL PROTECTED]> writes: > I have tried the following (which doesn't work) > dn[1] := \'a\'; > The parser doesn't like the [ that follows dn. I believe Joe Conway fixed this in 7.4. Note that you also need to initialize the array to something, because assigning to an elem

Re: [SQL] Arrays - a good idea?

2003-11-19 Thread Yasir Malik
Hello, I don't think there's any reason you should use arrays. You can do everything using tables, and it probably would be easier to use tables instead. Extracting information from arrays is also more difficult if you're using something like JDBC or the connectivity available in PHP. I don't kn

Re: [SQL] Arrays - a good idea?

2003-11-19 Thread Achilleus Mantzios
O kyrios Yasir Malik egrapse stis Nov 18, 2003 : > Hello, > I don't think there's any reason you should use arrays. You can do > everything using tables, and it probably would be easier to use tables > instead. Extracting information from arrays is also more > difficult if you're using something

Re: [SQL] Arrays - a good idea?

2003-11-18 Thread Yasir Malik
Hello, I don't think there's any reason you should use arrays. You can do everything using tables, and it probably would be easier to use tables instead. Extracting information from arrays is also more difficult if you're using something like JDBC or the connectivity available in PHP. I don't kn

Re: [SQL] Arrays Or Loop

2003-03-06 Thread Josh Berkus
Aspire, > 2. Can we use array for the above thing as > a. Make an array of the valid roll_numbers. such as > ('IDX'=>'ROLL_NUMBER') > b. Now select the array element by the index which will produce the > roll_number and work on it. > c. Array could be build by for loop >

Re: [SQL] arrays (was untitled)

2002-09-24 Thread Stephan Szabo
On Tue, 24 Sep 2002, Madhavi wrote: > How do I pass an array as an aruments in a postgres function? And how do I > use it in the function?? Well, I've only got a 7.3devel machine to test, but: create function f(int[]) returns int as 'select $1[1];' language 'sql'; select f('{3,4}'); seems to

Re: [SQL] Arrays

2000-12-31 Thread Oleg Bartunov
Wait some time. We have something you need - we implement RD-tree using GiST interface. Unfortunately, GiST was very poorly tested and supported, so we have to understand, fix and rewrite some part of code. There are still some problems but we hope to get working code in January. Oleg On