Skip to content

Introspection fails: "This function must not be called on compound database names." (report 1301) #1409

Closed

Description

@tontonrally

While introspecting with prisma2 (preview20).
The error is pretty generic, I don't know what part of the schema fails.

Schema parsing
thread 'main' panicked at 'This function must not be called on compound database names.', libs/datamodel/core/src/dml/traits.rs:14:13
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1028
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1412
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}

Activity

  1. janpio commented on Jan 22, 2020

    @janpio
    Contributor

    Thank you very much for this bug report, I can reproduce the output you posted with the data included in the error report - so we can now look into this.

    It's the first time I see an error message like this, so I will ask my colleagues what is going on here.

  2. changed the title [-]Introspection fails, report 1301[/-] [+]Introspection fails, report 1301: This function must not be called on compound database names.[/+] on Jan 22, 2020
  3. changed the title [-]Introspection fails, report 1301: This function must not be called on compound database names.[/-] [+]Introspection fails: "This function must not be called on compound database names." (report 1301)[/+] on Jan 22, 2020
  4. added
    bug/2-confirmed
    kind/bug
    on Jan 23, 2020
  5. janpio commented on Feb 4, 2020

    @janpio
    Contributor

    Internal Note:

    • This happens when IE finds a FK that is backed by 2 columns (table user, columns first_name, last_name)
    • It creates 1 relation field out of it with an auto generated name, and is backed by 2 actual database columns (user @relation(references: [first_name, last_name]) @map([user_first_name, user_last_name])) ("database name" = [user_first_name, user_last_name])
    • When QE code wants to retrieve the "database name" for that relation field, it can't handle the because it gets 2 names instead of 1
  6. janpio commented on Feb 18, 2020

    @janpio
    Contributor

    Hey @tontonrally, could you use the current alpha version of Prisma to Introspect again? This is probably not fixed yet, but the behavior might be different and it might be interesting for us to know what exactly is happening right now.

    It would also be super awesome if you could send us your underlying SQL schema to [email protected] (happy to sign an NDA if necessary) so we can easier reproduce this ourselves <3

  7. janpio commented on Feb 18, 2020

    @janpio
    Contributor

    I just tried prisma2 validate and prisma2 generate with the schema the error report contained @tontonrally, and I could successfully validate and generate a Prisma Client - so this might indeed be fixed. Possibly the introspect command itself will still fail, but I need either your help in trying that or you send us the schema.

    On the other hand I just looked through the schema from the error report for cases like described in the note above - and could not find any. So maybe I am looking in the wrong place completely...

  8. tontonrally commented on Mar 11, 2020

    @tontonrally
    Author

    @janpio sorry mate, I had no time

    In order to inform, I didn't manage to get things working with the alpha branch, I tried a week ago. But, with the preview023, I manage to do the introspection without errors + generate the client and connect to the db. 👌

    Thanks

  9. janpio commented on Mar 11, 2020

    @janpio
    Contributor

    Thanks for the update, important thing is that it now works for you <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/2-confirmedkind/bugtopic: AUMFIDARRtopic: introspection

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions