question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Introspection] Decide on a way forward for introspection of types our internal type system currently cannot represent

See original GitHub issue

The example of this problem we came across in https://github.com/prisma/prisma-client-js/issues/507 is postgres’ tsvector. It is an opaque data structure that doesn’t really make sense as a string and can only be constructed through postgres expressions, so it is not currently doable through prisma-client (outside of the raw API).

We currently introspect tsvector columns as String (the fallback for types we do not handle yet), but prisma will fail to read or write to these columns. The problem is especially acute when we these columns are not nullable.

The reasonable choice for now would probably be to ignore these columns when introspecting, and signal that we did that with a warning.

cc @janpio

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
schicklingcommented, Mar 2, 2020

In case we’re indeed commenting out unsupported fields we should also disable write operations (in the Prisma Client) that could possibly fail (e.g. trying to create a new row with a required value missing).

1reaction
janpiocommented, Feb 24, 2020

Long term we definitely want to support all possible types. Supporting them we track under the name “native database types”.

But right now all types that can not be represented by one of the types we already support, or via a fallback to a string are problematic. That means that we have to find a guardrail for these types so user’s can build applications with these types anyway.

I agree that we should remove them from the models by commenting them out. This can become problematic if the columns are not nullable and there is no default value set on a database level. There might be dirty hacks to work around that in some way, but we do not really want to start getting into that.

So tasks are:

  1. Find out which types we can not properly represent right now.
  2. Decide which ones of those we can not support via String.
  3. Implement commenting out of these types in Introspection, including a warning given via CLI.
  4. Look at all cases of that via the warnings generated during Introspection, and see if any of them are not nullable or are special in any other way.
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Introspection] Comment out all unsupported column types
[Introspection] Decide on a way forward for introspection of types our internal type system currently cannot represent #1690.
Read more >
Why You Should Disable GraphQL Introspection In Production
In this post, we'll discuss why we believe you should disable GraphQL introspection in production, how to do it, and present a way...
Read more >
Introspection - Stanford Encyclopedia of Philosophy
The temporal proximity condition: Introspection is a process that generates knowledge, beliefs, or judgments about one's currently ongoing ...
Read more >
Introspection - Wikipedia
Introspection is the examination of one's own conscious thoughts and feelings. In psychology, the process of introspection relies on the observation of ...
Read more >
Introspection: Definition, Uses, Examples, and Tips
One way to use introspection is for reflection, which involves consciously examining our internal psychological processes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found