-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed error ranges and add trigger tests
- Loading branch information
Showing
6 changed files
with
507 additions
and
25 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
sample/definitions/function/syntax_error_trigger_column_does_not_exist.pgsql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
CREATE TABLE users_1 ( | ||
id integer not null PRIMARY KEY, | ||
updated_at timestamp with time zone not null DEFAULT now() | ||
); | ||
CREATE TABLE users_2 ( | ||
id integer not null PRIMARY KEY | ||
); | ||
CREATE TABLE users_3 ( | ||
id integer not null PRIMARY KEY | ||
); | ||
|
||
DROP trigger IF EXISTS update_users_1_modtime on user_1; | ||
DROP trigger IF EXISTS update_users_2_modtime on user_2; | ||
DROP trigger IF EXISTS update_users_3_modtime on user_3; | ||
|
||
create or replace function update_updated_at_column () | ||
returns trigger | ||
language plpgsql | ||
as $function$ | ||
begin | ||
new.updated_at = NOW(); | ||
return new; | ||
end; | ||
$function$; | ||
|
||
create trigger update_users_3_modtime -- should raise error | ||
before update on users_3 for each row | ||
execute function update_updated_at_column (); | ||
|
||
create trigger update_users_1_modtime | ||
before update on users_1 for each row | ||
execute function update_updated_at_column (); | ||
|
||
create trigger update_users_2_modtime -- should raise error | ||
before update on users_2 for each row | ||
execute function update_updated_at_column (); |
Oops, something went wrong.