Strange, it works here. What version are you using:
test=> create table xx as select * from pg_class where 1=0;
SELECT
test=> insert into xx select * from pg_class limit 1;
INSERT 16869 1
test=> select * from pg_class;
(1 row)
---------------------------------------------------------------------------
pgsql-bugs@postgresql.org wrote:
> Guillaume Lafarge (guillaume.lafarge@exalog.com) reports a bug with a severity of 3
> The lower the number the more severe it is.
>
> Short Description
> LIMIT clause bugs with insert...select
>
> Long Description
> The LIMIT clause is not working with SELECT command if SELECT is part of INSERT command.
>
> Sample Code
> insert into table1 select * from table2 limit 20;
>
> No file was uploaded with this report
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026