Re: Insert and limit

From: "Richard Huxton" <dev(at)archonet(dot)com>
To: "Matteo Centenaro" <gente_che_mixa(at)hotmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Insert and limit
Date: 2001-06-15 13:48:03
Message-ID: 002b01c0f5a1$cdea5480$1001a8c0@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From: "Matteo Centenaro" <gente_che_mixa(at)hotmail(dot)com>

> Hi all,
> is possible that the limit statement dosen't run correctly in this case:
>
> Insert into temp
> Select * from tab1
> Where cod = xxxx
> Limit yyy;
>

[follow-up message said Matteo was interested in plpgsql]

Still seems OK.

richardh=> create function copy_foo() returns int as '
richardh'> begin
richardh'> insert into foo2 select * from foo limit 1;
richardh'> return 1;
richardh'> end;' language 'plpgsql';
CREATE
richardh=> select copy_foo();
copy_foo
----------
1
(1 row)

richardh=> select * from foo2;
a | b
---+----------------------------------
4 | Jack Smith
(1 row)

You weren't using SELECT INTO were you - there is a different form for
plpgsql.

- Richard Huxton

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Barnard 2001-06-15 14:04:06 Re: Indexing varchar[]'s
Previous Message Dip 2001-06-15 13:43:00 Postgres Internals