Search code examples
postgresqlpgadminquotation-marks

PostgreSQL : what are simple quotation marks for?


How could I remove simple quotation marks that appear in empty cells? See image below

View of a table including simple quotation marks

The columns can be either TEXT or CHARACTER VARYING(), these signs are still present. I have other tables with no quotation marks in empty cells... The extract above is the result of an importation of an ORACLE table into my PGSQL database. This is probably the reason why.


Solution

  • My guess it that the importation process introduced single quotes. If this query solves it

    select num_position, replace(num_position, '''', '')
    from t;
    

    then replace all single quotes

    update t
    set
        num_position = replace(num_position, '''', ''),
        num_plan = replace(num_plan, '''', '')