Skip to content

Incorrect conversion of numeric types #151

Description

@Yogurt4

WP Version: 6.8.3
PG4WP Version: 3.4.1

Error:

WordPress database error ERROR: syntax error at or near "("

RAW SQL

CREATE TABLE wp_pmxi_hash (
        hash BINARY(16) NOT NULL,
        post_id BIGINT(20) UNSIGNED NOT NULL,
        import_id SMALLINT(5) UNSIGNED NOT NULL,
        post_type VARCHAR(32) NOT NULL DEFAULT '',
        PRIMARY KEY  (hash)
)

Expected Rewritten SQL

CREATE TABLE wp_pmxi_hash (
        hash BYTEA CHECK (octet_length(hash) = 16) NOT NULL,
        post_id BIGINT NOT NULL,
        import_id SMALLINT NOT NULL,
        post_type VARCHAR(32) NOT NULL DEFAULT '',
        PRIMARY KEY  (hash)
)

Both the precision (20) and (5) should be removed, along with UNSIGNED.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions