Conversation
SpyKeeR
added a commit
to SpyKeeR/opensips-cp-pgsql
that referenced
this pull request
Jul 29, 2026
config/db_schema.pgsql was a mechanical conversion of the MySQL dump and carried several defects that make a fresh PostgreSQL install non-functional: * ocp_dashboard INSERT used backticks (MySQL identifier quoting, a syntax error in PostgreSQL) so the default dashboard was never inserted. The two JSON literals also relied on MySQL backslash escaping; with standard_conforming_strings = on the backslashes are kept verbatim and json_decode() returns null -- an invalid dashboard with no SQL error at all. Backticks removed, both literals prefixed with E. (see upstream OpenSIPS#306) * ocp_tools_config declared three independent UNIQUE constraints on module, param and box_id instead of the composite UNIQUE (module, param, box_id) of the MySQL schema, allowing only one row per module in the whole table. (see upstream OpenSIPS#310) * ocp_boxes_config lost the name column and its UNIQUE constraint, which is the root cause of the "Undefined array key name" warnings raised by config/boxes.load.php and the boxes_config templates. * ocp_extra_stats had no unique key, leaving no conflict target for the upsert in smonitor/statistics.php. Added UNIQUE (name, tool, box_id). * ocp_monitoring_stats lost PRIMARY KEY (name, time, box_id) with no index in replacement, and ocp_monitored_stats had its primary key reduced to name alone, preventing a statistic from being monitored on more than one box. Both restored. * The INSERTs forcing assoc_id=1 and id=1 never consumed their sequence. MySQL readjusts AUTO_INCREMENT on an explicit insert, PostgreSQL does not, so the first system or panel added through the UI failed on a duplicate key. Added setval() after both. * Dropped the trailing CREATE TABLE config block: it collides with OpenSIPS' own scripts/postgres/config-create.sql, which is authoritative. * Removed the three SET CLIENT_ENCODING TO 'latin1' statements, leftovers from a MySQL dump; the target encoding is UTF8. Also adds POSTGRESQL.md documenting each fix and its upstream status. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backtick is not a valid quote character for table names in PostgreSQL and strings containing C-style escaped characters should be prefixed with the letter "E".