From: "Matteo Centenaro" <gente_che_mixa@hotmail.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