{InternalError}ERROR: Assert false - Invalid type: 705

664 views Asked by At

based on https://pygresql.readthedocs.io/en/latest/contents/pg/adaptation.html

sql = "SELECT * FROM user_table WHERE login = %s AND passwd = %s"

db.query_formatted(sql, (login, passwd)).getresult()[0]

I reused this snippet of code to try to use the library SQL replacement as shown in this example:

import pg

pg.DB(*credentials)

sql = "select %s, %s from my.table limit 10"
c.query_formatted(sql, ("id", "event_time")).getresult()[0]

and trying to query a Redshift table.

Unfortunately I get this error message

{InternalError}ERROR:  Assert
DETAIL:  
  -----------------------------------------------
  error:  Assert
  code:      1000
  context:   false - Invalid type: 705
  query:     9876543
  location:  tbl_trans.hpp:923
  process:   padbmaster [pid=6543]
  -----------------------------------------------

which I really have no idea how to interpret.

I also tried to query with another client

select *
from stl_error
where pid = 6543;

but all I get is:

userid,process,recordtime,pid,errcode,file,linenum,context,error
100,padbmaster,2021-03-01 12:00:00,6543,1000,/home/ec2-user/padb/src/sys/tbl_trans.hpp,923,Assert,false - Invalid type: 705                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Anyone knows what's the problem here? Any other suggestion?

1

There are 1 answers

2
Cito On

Two problems here:

  1. PyGreSQL does not officially support Redshift. Though it may work, PyGreSQL was made for PostgreSQL only. It doesn't contain any special provisions for Redshift and is only tested with PostgreSQL (the current version requires PostgreSQL 9 or newer).

  2. The select list must be specified as literals specifying the columns: select id, event_time from ... Query parameters are only used to insert values into queries.