Q:

use of json operators inside SQL/SPSS query

I'm trying to parse and sum values from a jsonb field (eventos) in a postgresql table (eventos_detalle) that I'm getting from SPSS Statistics (ODBC GET DATA) The jsonb_to_record function is working but the ->> operator is causing a syntax error. I've quoted and double quoted everything I can but still can get it to work. Any comment will be very appreciated.
Here's the code exactly copied from SPSS Syntax Editor
GET DATA
  /TYPE=ODBC
  /CONNECT='DSN=PostgreSQL30;DATABASE=informes;SERVER=10.4.0.141;PORT=5432;UID=erubio;PWD=-!7K-X,'+
    '-!o/$,:!/,J-,///!$!;SSLmode=disable;ReadOnly=0;Protocol=7.4;FakeOidIndex=0;ShowOidColumn='+
    '0;RowVersioning=0;ShowSystemTables=0;Fetch=100;UnknownSizes=0;MaxVarcharSize='+
    '255;MaxLongVarcharSize=8190;Debug=0;CommLog=0;UseDeclareFetch=0;TextAsLongVarchar='+
    '1;UnknownsAsLongVarchar=0;BoolsAsChar=1;Parse=0;ExtraSysTablePrefixes=;LFConversion='+
    '1;UpdatableCursors=1;TrueIsMinus1=0;BI=0;ByteaAsLongVarBinary=1;UseServerSidePrepare='+
    '1;LowerCaseIdentifier=0;D6=-101;XaOpt=1'
  /SQL='SELECT * FROM informes.public."eventos_detalle", jsonb_to_record(eventos)'
            ' AS x(hlc text, llc text, event text, fecha text, total real, accion text, fuente text,'
                    ' cliente text, VirtualServer text, destinationip text, eventdirection text, destinationport text),'
                    ' SUM(('eventos'->>'total')::float) AS total'
  /ASSUMEDSTRWIDTH=255

A:

If the ->> is indeed the problem and not the invalid use of a string literal instead of a column identifier, you can replace the ->> operator with a function call: 
eventos ->> 'total'

can be replaced with:
jsonb_extract_path_text(eventos, 'total')

