ERROR: COPY to a file is not supported
I am working on a prisma postgres TEMP table, and want to export it for use on another server.
I am using a SQL COPY command through prisma.$queryRawUnsafe(), the command is
COPY "Meeting_temp" to '/tmp/fastLoadCopyMeeting_temp.2025-05-19T16:53:24.772+00:00.rows'
This works fine on my Mac, but in AWS (AWS GNU Linux), I get a
PrismaClientKnownRequestError:
Invalid
prisma.$queryRawUnsafe()
invocation:
Raw query failed. Code: 0A000
. Message: ERROR: COPY to a file is not supported
HINT: Anyone can COPY to stdout or from stdin. psql's \\copy command also works for anyone.\
I don't believe that psql is a viable option for a TEMP file, which is created within a specific session.
Does this 0A000
error mean that I am having access problems to the /tmp directory, or does it really
mean 'COPY to a file is not supported' on our AWS instance, but not on my Mac?
-------------------
"prisma": "6.5.0",
(PostgreSQL) 14.174 Replies
You decided to hold for human wisdom. We'll chime in soon! Meanwhile,
#ask-ai
is there if you need a quick second opinion.#ask-ai
Hey!
I think the SQL command COPY ... TO '/path/to/file' can only be executed by a superuser, and only on the database server itself.
I think your AWS RDS instance might have restricted it
Thanks Nurul, I am sure that is the right explanation!