e.g.
create function foo(_int4) returns int2 as'
declare
a _int4 alias for $1;
i int:=1;
begin
while a[i] loop
i:=i+1;
end loop;
return i-1;
end;
' language 'plpgsql';
you can call it by:
select foo('{1232131,12312321,3424234}');
you should get 3.
Jie LIANG
Internet Products Inc.
10350 Sci
Hi all,
I must apologise as it turns out the 'culprit' wasn't really pl/pgsql.
The test box I was testing on is Mandrake Linux 7.2, which comes with
PostgreSQL 7.0.2. Everything else has version 7.0.3 installed on it,
and I naively assumed that 7.0.3 was installed on the test box.
After instal
Saluton,
On Tue, Jan 30, 2001 at 03:54:53PM -0800, [EMAIL PROTECTED] wrote:
...
> I'm building a script to create a relatively large database. At some
> point in the script I would like to be able to save values into
> variables so that I can use them to populate rows.
Your script will be handl
I need to pass an array to a function ( int4, variable number of elements) .
How do i declare the parameter, and how can i tell the numer of recieved elements?
Thanks
/Sveinung
"Ross J. Reedstrom" wrote:
>
> This is a bug that was fixed in 7.1beta for sure, but also 7.0.3,
> I believe. So it's as simple as upgrading.
Thanks, I'll upgrade. I couldn't find this listed in any changes files
so can you (or anyone) confirm that this is fixed in 7.0.3?
And does fixed mean
Hi,
where id= or id between 3 and 12;
or
where id in (3,4,5,6,7,8,9,10,11,12,);
Jie LIANG
Internet Products Inc.
10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873
[EMAIL PROTECTED]
www.ipinc.com
On Wed, 31 Jan 2001, Antti Linno wrote:
> Good morning.
Since you are selecting all the rows of media, there is no reason to use the
index to do this as it would just slow things down.
Mark
Najm Hashmi wrote:
>
> Hi all,
> I am unable to understand why my inidcies are not used in the query.
> I have following indices:
> index on categories.root
Saluton,
wouldn't it be a good idea (and if it is, I am not sure what list to
post it to) to have psql's option -f / --file take "-" for stdin, as
many programs do?
In shell scripts this would facilitate using here-documents:
cat <
Saluton,
in the 7.0.2-docs I find the function textpos:
,
|Table 5-5. String Functions
| ...
|textpos(text,text) text locate specified substring
|position('high','ig')
`
However, in psql it seems one has to use strpos:
,
| litdb=> select textpos('a
Hi all,
I am unable to understand why my inidcies are not used in the query.
I have following indices:
index on categories.root
index on media.category
unique index on categories.id
Here is my query :
mondo=# explain select m.id
form media m, categories c
Sorry to polute the list with this, but:
Could anybody please give me instructions on how to get OFF the list?
TIA
Miguel Sofer
Try:
insert into table (name,id,city) values ('roger rabbit',NULL,'carrot city')
-Original Message-
From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
Sent: Wednesday, January 31, 2001 7:16 AM
To: [EMAIL PROTECTED]
Subject:no value for numeric filed in SQL statement cause
This is a bug that was fixed in 7.1beta for sure, but also 7.0.3,
I believe. So it's as simple as upgrading.
Ross
On Thu, Feb 01, 2001 at 10:09:29AM -0500, Najm Hashmi wrote:
> Hey Rick,
> I am sure there are more elegant solutions but I have a simple
> one. Write a trigger that wil
The problem is fixed in the 7.1 beta series.
Rick Delaney wrote:
>
> I'm using 7.0 and have noticed that I need to grant SELECT and UPDATE
> permissions on any referentially-related tables. Can/should I get
> around this? A somewhat contrived example:
>
> CREATE TABLE emp (
> id integer PRIM
Try
SELECT * FROM Towns WHERE id= OR id BETWEEN 3 AND 12
Antti Linno wrote:
>
> Good morning.
>
> Is there some way to make interval query?
>
> Towns table(estonia towns, heh :P)
>
> id | name
>
> 1 Elva
> 2 Tartu
> Tallinn
> 3 Tallinn/Haabersti
> 4 Tall
Hey Rick,
I am sure there are more elegant solutions but I have a simple
one. Write a trigger that will grant the permissions before insert or
update and and revoke all privileges after the insert or update.
-Najm
Rick Delaney wrote:
> I'm using 7.0 and have noticed that I need to gr
The column name is OID.
-Original Message-
From: Padmajha Raghunathan [SMTP:[EMAIL PROTECTED]]
Sent: Tuesday, January 30, 2001 11:20 PM
To: [EMAIL PROTECTED]
Subject:Rownum/ row Id
Hi,
Is there a provision to delete the duplicate records using row num/
row id as avai
You can do it one of two ways, dynamically build your queries and leave
out fields that are blank (they will be set to the default value or, if
none is specified, NULL), i.e.:
INSERT INTO table (name, city) VALUES ('roger rabbit', 'carrot city');
or, assign a default value to the id variable, an
Hi there
I have a table with char and int fields. From my form I get no values back
for int fields when they are left blank. This causes the SQL insert to
fail.
field type
name char
id int2
city char
insert into table (name,id,city) values ('roger rabbit',,'carrot city')
The default for
Hello.
Is it somehow possible to fetch only the number of tuples
after declaring a cursor? If I move a cursor forward by
1 in a ten record long table, is moves only to the end,
but it doesn't tell me how many steps it could do, and
where it is.
Thanks
Baldvin
Dear All,
i am trying to insert image in postgres 7.0 by using following code:
i am getting FastPath protocol error : Z
Could any one reply earliest...?
Any feasible solution ?
PreparedStatement stmnt =conn.prepareStatement("insert into
grms_photogallary (user_id,oid) values (?,?)");
/
Hi ALL,
I am trying to insert the image from the client to database by
spicifying the Windows NT machine filepath.
The server(postgresql 7.0) is situated at the linux.
If filepath is linux m/c's then i can ...
If filepath is winNT then i have Exception saying :
ERROR: lo_import : ca't open unix
> Is there some way to make interval query?
>
> What I need is when the town's id= I want to make query
> where id= OR id=[3..12] for example. I could generate bunch of OR's
> like id=3 OR id=4 ... but is there some more elegant solution?
>
This should work : WHERE id = OR id BETW
Good morning.
Is there some way to make interval query?
Towns table(estonia towns, heh :P)
id | name
1 Elva
2 Tartu
Tallinn
3 Tallinn/Haabersti
4 Tallinn/Mustamae
...
etc.
What I need is when the town's id= I want to make query
where id= OR id=
24 matches
Mail list logo