Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temp tables without the PK aren't converted #1

Closed
yallie opened this issue Mar 20, 2017 · 0 comments
Closed

Temp tables without the PK aren't converted #1

yallie opened this issue Mar 20, 2017 · 0 comments

Comments

@yallie
Copy link
Owner

yallie commented Mar 20, 2017

Here is the test case:

create temporary table tt(id int);
select create_permanent_temp_table('tt');

And the output is:

ErrorCode: -2147467259
Severity: ERROR, Code: 42601, Line: 1078, Position:
ErrorMessage: syntax error at end of input

The problem is in the instead-of triggers: update and delete statements use the primary key columns:

-- handle the trigger operation
if lower(tg_op) = 'insert' then
	insert into "tt$tmp"(id) 
	values (new.id);
	return new;
elsif lower(tg_op) = 'update' then
	update "tt$tmp" 
	set id = new.id
	where ;                                  -- HERE
	return new;
elsif lower(tg_op) = 'delete' then
	delete from "tt$tmp" 
	where ;                                  -- AND HERE
	return old;
end if;
@yallie yallie changed the title Temporary tables without the primary key Temporary tables without the primary key aren't handled Mar 20, 2017
@yallie yallie changed the title Temporary tables without the primary key aren't handled Temp tables without the PK aren't converted Mar 20, 2017
@yallie yallie closed this as completed Mar 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant