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
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
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
--
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
"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,
: 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
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
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
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
"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
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
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
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
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
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
"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
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
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
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
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
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
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
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
>
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
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
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
> 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
27 matches
Mail list logo