Unable to resolve type in a local scope.

Answered

Hi there,

 

I have the following code:

 

declare
count_items int;
items text [];
page_count int;
results text [];
cos int;
coe int;
begin
cos := (page - 1) * per_page;
coe := page * per_page;
items := array(select id
from search(keywords, searched_company, latitude, longitude, job_types, categories, radius));
count_items := array_length(items, 1);
results := items[cos :coe];
raise notice 'found % items', count_items;
if count_items % per_page = 0
then page_count := count_items / per_page;
else page_count := (count_items / per_page) + 1; end if;
raise notice 'page count %', page_count;
return json_build_object('items', results, 'count', count_items, 'page_count', page_count);

end;

But when i try to run in DataGrip it tells me that "Unable to resolve object type 'cos'"

It works normally and without error when I run it directly in the Postgres console.

I updated to the last version.

 

Screenshots:

 

Did I miss something or there is a bug?

 

Best,

1 comment
Comment actions Permalink

I created an issue https://youtrack.jetbrains.com/issue/DBE-6901 based on your description

0

Please sign in to leave a comment.