Skip to content

"CREATE TABLE IF NOT EXISTS" results in a false-positive error if table already exists #52

@pk-ot

Description

@pk-ot

Take a script like the auto-generated migration history table creation by Entity Framework:

CREATE TABLE IF NOT EXISTS "__EFMigrationsHistory" (
    "MigrationId" character varying(150) NOT NULL,
    "ProductVersion" character varying(32) NOT NULL,
    CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId")
);

This results in a false error if the table actually already exists:

psql:/home/runner/work/somethingsomething.sql:5: NOTICE:  relation "__EFMigrationsHistory" already exists, skipping
[...]
Error: Error occurred while running action:
Error: error in file: /home/runner/work/somethingsomething.sql
psql:/home/runner/work/somethingsomething.sql:5: NOTICE:  relation "__EFMigrationsHistory" already exists, skipping

Which subsequently and wrongly fails the build.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions