Search code examples
pythonpostgresqlsslpython-3.5psycopg2

psycopg2.DatabaseError: SSL error: bad length


Python 3.5, psycopg2 2.7.4, connects to postgresql database and gets error psycopg2.DatabaseError: SSL error: bad length
What does this error mean - some SSL certificate is not valid?
Here's traceback:

Traceback (most recent call last):
  File "src/db_importer.py", line 278, in <module>
    main()
  File "src/db_importer.py", line 255, in main
    run_process(args, db_params)
  File "src/db_importer.py", line 198, in run_process
    import_csv(cur, schema, table_name, args.raport_data)
  File "src/db_importer.py", line 130, in import_csv
    cur.copy_from(f, '{}.{}'.format(schema, table_name), sep=';', columns=cols)
psycopg2.DatabaseError: SSL error: bad length

Solution

  • try 'vacuum full analyze your table' on postgres level, it worked for me. Deadtulips was the issue and 'After freeing some space' might have been autovaccum running