weasel icon indicating copy to clipboard operation
weasel copied to clipboard

NRE in Postgres Table.readExistingAsync

Open migajek opened this issue 2 years ago • 3 comments

using Marten 6.0.5, running Storage.Database.WriteMigrationFileAsync(fn);

  1. on the first run, it generates considerably large script that creates tables for documents among others
  2. on the subsequent run it fails with NRE as shown below:

image

the schema for this table is a regular Marten schema (as taken from the first migration script)

CREATE TABLE public.mt_doc_accesskeymodel (
    id                  uuid                        NOT NULL,
    data                jsonb                       NOT NULL,
    mt_last_modified    timestamp with time zone    NULL DEFAULT (transaction_timestamp()),
    mt_version          uuid                        NOT NULL DEFAULT (md5(random()::text || clock_timestamp()::text)::uuid),
    mt_dotnet_type      varchar                     NULL,
CONSTRAINT pkey_mt_doc_accesskeymodel_id PRIMARY KEY (id)
);

migajek avatar Jul 26 '23 09:07 migajek

strange, but I altered the db user with "superadmin" and it doesn't occur anymore at this point

migajek avatar Jul 26 '23 09:07 migajek

Not strange, Postresql quiet fails accessing the schema metadata when you don't have the prerequisite rights. Not a new problem:(

jeremydmiller avatar Aug 04 '23 15:08 jeremydmiller

Should there be a different exception be thrown? I mean a NRE alludes a bug (here within Weasel) which isn't the case. Maybe wrap the NRE in custom exception that has a hint about PostgreSQL's behavior with missing rights.

gfoidl avatar Dec 17 '23 09:12 gfoidl