Functions with `DEFAULT nextval()` break autocomplete + function view
- Dominant language
- Python
- Stars
- 486
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
## What did you do?
- I created the following reduced test-case function with a parameter defaulted to `nextval`:
- ```sql
CREATE SEQUENCE IF NOT EXISTS test_seq;
CREATE OR REPLACE FUNCTION public.test(id integer DEFAULT nextval('test_seq'))
RETURNS boolean
RETURN false;
```
- Notably, changing out `nextval` for a different function call, ie `degrees(0.5)` seemed to remove the issue. I'm not sure exactly what part of the `nextval` call is breaking the parser, but it's clearly not the function call.
- I typed in the SQL editor
- I opened the function view from the sidebar entry `test (integer)`
## What did you expect to happen?
- I expected autocomplete to work
- I expected the function view to work
## What actually happened?
- Autocomplete failed and the following error popped up:

- The function viewer failed and the following error popped up:

## What software versions are you using?
**Postico version:** 2.1 (9682)
**macOS version:** Sonoma 14.3
**PostgreSQL version:** 16.1
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue in the SQL editor with the provided CREATE SEQUENCE and CREATE FUNCTION statements against PostgreSQL 16.1, then inspect the autocomplete and sidebar entry `test (integer)` function-view paths. Done means the `nextval` default no longer causes either view to fail and autocomplete works for the reproduced case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- databases, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100