postgresqlplpgsqlphppgadmin

Postgresql "invalid end sequence"


I've a function which adds users on my application. It does a few check, salts and hashes the password and then inserts the values. Now, when i run the function I get

ERROR: invalid end sequence

(to be honest, i get it in italian and had to do quite a job to find the corresponding english string). Now, the single parts work very well alone, but if I put everything together in a function I get the error so I'm pretty out of ideas. Any suggestion?


Solution

  • This error happens when trying to decode incorrectly encoded base64 contents. Example:

    => select decode('aa', 'base64');
    

    ERROR: invalid end sequence

    as opposed to:

    => select decode('aa==', 'base64');
    
     decode 
    --------
     \x69
    (1 row)