specs2 null check fails with PostgreSQL views
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 2.2k
- Forks
- 379
- Avg merge
- 14m
- Merged PRs (30d)
- 8
Description
The specs2 unit tests falsely expects all columns to be nullable if the query uses a view. The root cause seems to be incorrect metadata from PostgreSQL. PostgreSQL reports all view columns as nullable even for trivial views:
create table test (id int not null);
create view test_view as select * from test;
\d test
Table "public.test"
Column | Type | Modifiers
--------+---------+-----------
id | integer | not null
viskar=> \d test_view
View "public.test_view"
Column | Type | Modifiers
--------+---------+-----------
id | integer |
Related StackOverflow question: https://stackoverflow.com/questions/17301323/why-are-my-views-columns-nullable
Maybe a simple solution would be to be able to manually disable the null check for a query but keeping the other type mapping validation features enabled?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the specs2 unit tests and the nullability metadata handling for PostgreSQL views, then reproduce the shown table and view definitions. Confirm how PostgreSQL reports view columns and define done as avoiding a false nullability failure while preserving the other type-mapping validations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, scala
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100