Re: error: insert has more expressions than target column

From: Richard Huxton <dev(at)archonet(dot)com>
To: Dino Vliet <dino_vliet(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: error: insert has more expressions than target column
Date: 2004-09-07 13:59:03
Message-ID: 413DBEA7.9050905@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dino Vliet wrote:
> Hi there,
> I want to put a number of records (variable number
> depending on a attribute of a table) into a certain
> table with a trigger statement.
>
> I have created the follwing trigger:
>
> CREATE FUNCTION vullalles() RETURNS trigger AS '
> BEGIN
> FOR i in 0..7 LOOP
> INSERT INTO lessons (select
> dayofweek,startdate,endate,startime,endtime,teacher,location,roomnr
> from courseschedule);

Try it without the brackets around select, or put the column-names in
brackets before it.

> startdate := startdate + i*7;
> EXECUTE startdate;

Not sure what this is supposed to be doing. The EXECUTE is redundant.

> RETURN NEW;
> END LOOP;
> END;
> ' LANGUAGE plpgsql;

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dino Vliet 2004-09-07 14:07:08 Re: error: insert has more expressions than target column
Previous Message David Garamond 2004-09-07 13:47:56 Dumping pg_shadow and pg_database as SQL using pg_dump