I have a script that contains the following psql command:
psql -h $PHOST -p $PPORT -U $PUSER -d $PDATABASE -c "SELECT COUNT(*) FROM (${SQL%?}) AS query;"
when I passed a simple query that query one or two relations, no problem. However, when I passed a long query, I got this error:
/usr/bin/psql: Argument list too long
I found solutions for "Argument list too long" with mv command I tried it, but nothing changed.
I used ulimit -S -s unlimited before the psql command to increase the MAX_ARG size, but still getting the error.
How could I solve the error of psql: Argument list too long?