Skip to content

Postgresql is not valid #2088

@regnerisch

Description

@regnerisch

Tempest version

3.0

PHP version

8.5

Operating system

macOS

Description

Most (when not all) Postgresql queries are not valid. They are all build with Mysqls `` (single backtick) quote character. But Postgres quote character is ".

Adding a quote and wrapInQuotes method to DatabaseDialect enum could help building valid SQL for the future:

    public function quote(): string
    {
        return match ($this) {
            self::POSTGRESQL => '"',
            self::MYSQL, self::SQLITE => '`',
            default => UnkownQuoteException(),
        };
    }

    public function wrapInQuotes(string $value): string
    {
        $quote = $this->quote();

        return sprintf('%s%s%s', $quote, $value, $quote);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions