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

[SQL] Arrays, types and prodedures

2008-07-25 Thread Chris Hoy
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 store prodedure is as follows: CREATE OR REPLACE FUNCTION doIndex

[SQL] Arrays, multidimensional ANY (v 8.2)

2007-01-30 Thread Niklas Bergius
Hello everyone. Can anyone tell me how I can test for the occurrence of an array in an array? Intuitively, this should work: SELECT ARRAY[1,2,3] = ANY(ARRAY[[1,2,3],[2,3,4]]); However, this gives me "operator does not exist: integer[] = integer". I'm running 8.2. -- Niklas Bergius --

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

[SQL] Arrays in PL/pgSQL routines?

2005-12-29 Thread Ken Winter
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 of the documentation that says how to declare a simple arr

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

[SQL] ARRAYs and INDEXes ...

2005-08-15 Thread Marc G. Fournier
Can't seem to find anything concerning this in the docs, and I don't think it is something that can be done, but figure I'll double check before I write it off completely ... If I create a table: CREATE TABLE customers ( customer_id SERIAL, monthly_balance DECIMAL(7,2)[12] ); Is it poss

[SQL] arrays and polygons

2004-05-31 Thread David
Hi there i am having problems inserting an array of polygons into a table, i have added the column using: ALTER TABLE species ADD COLUMN location polygon[]; this works fine, but when i try INSERT INTO species (location) VALUES ('{((432,89), (45,87), (89,87)), ((54,78), (34,98))}; I get the foll

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

[SQL] arrays in pl/pgsql

2003-12-15 Thread Michael Shapiro
Is it possible in pl/pgsql to declare and then assign to arrays? For example if I declare an array as follows DECLARE dn text[]; How do I assign the first element to a string (say 'a'). I have tried the following (which doesn't work) dn[1] := \'a\'; The parser do

Re: [SQL] Arrays - a good idea?

2003-11-19 Thread Yasir Malik
n PHP. I don't know the criteria of when arrays are necessary, but I cannot think of an example where arrays are absolutely necessary Regards, Yasir On Tue, 18 Nov 2003, Paul Ganainm wrote: > Date: Tue, 18 Nov 2003 22:05:00 - > From: Paul Ganainm <[EMAIL PROTECTED]> > To

Re: [SQL] Arrays - a good idea?

2003-11-19 Thread Achilleus Mantzios
ically formatted. > > On Tue, 18 Nov 2003, Paul Ganainm wrote: > > > Date: Tue, 18 Nov 2003 22:05:00 - > > From: Paul Ganainm <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED] > > Subject: [SQL] Arrays - a good idea? > > > > > > > > Hi a

Re: [SQL] Arrays - a good idea?

2003-11-18 Thread Yasir Malik
n PHP. I don't know the criteria of when arrays are necessary, but I cannot think of an example where arrays are absolutely necessary Regards, Yasir On Tue, 18 Nov 2003, Paul Ganainm wrote: > Date: Tue, 18 Nov 2003 22:05:00 - > From: Paul Ganainm <[EMAIL PROTECTED]> > To

[SQL] Arrays - a good idea?

2003-11-18 Thread Paul Ganainm
Hi all, Even though PostgreSQL supports arrays, is it a good idea to use them? I mean, they a) don't conform to the relational model and b) are not transportable so if one is designing an app, should one use them? When should they not/never be used? What are the criteria for justifying

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
On Sun, 31 Dec 2000, Albert REINER wrote: > Date: Sun, 31 Dec 2000 22:29:33 +0100 > From: Albert REINER <[EMAIL PROTECTED]> > To: PostgreSQL-SQL <[EMAIL PROTECTED]> > Subject: [SQL] Arrays > > Saluton, > > I somehow get the impressions that support for

[SQL] Arrays

2000-12-31 Thread Albert REINER
Saluton, I somehow get the impressions that support for arrays is not a high priority with PostgreSQL, even though I think it would be very handy. On the other hand, the system itself uses arrays e.g. for user groups, so I guess there should be readily available functions/operators for dealing wi

[SQL] arrays in PostgreSQL

2000-12-14 Thread Kovacs Zoltan Sandor
> Is it possible to return an array from a plpgsql function?? AICR, it is impossible. In addition, it's not suggested using arrays at all: the array based logic is foreign from SQL solutions. In fact PostgreSQL doesn't have a good array support. My friend who built our logic data model, said that