Re: Insert and limit

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Insert and limit
Дата
Msg-id 002b01c0f5a1$cdea5480$1001a8c0@archonet.com
обсуждение исходный текст
Ответ на Insert and limit  ("Matteo Centenaro" <gente_che_mixa@hotmail.com>)
Ответы Re: Insert and limit  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
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


В списке pgsql-general по дате отправления:

Предыдущее
От: "Richard Huxton"
Дата:
Сообщение: Re: Insert and limit
Следующее
От: will trillich
Дата:
Сообщение: OT: Apache::Session::DBI vs postgresql? --help