From kj@limes.com.pl Fri May 22 20:26:52 2026 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vDpXT-00HBDe-Sf for pgsql-sql@arkaria.postgresql.org; Tue, 28 Oct 2025 19:39:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vDpXS-00Eoby-Pv for pgsql-sql@arkaria.postgresql.org; Tue, 28 Oct 2025 19:39:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vDpXS-00EobM-GU for pgsql-sql@lists.postgresql.org; Tue, 28 Oct 2025 19:39:25 +0000 Received: from deimos.limes.com.pl ([193.110.228.48]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1vDpXO-004Fz2-0u for pgsql-sql@lists.postgresql.org; Tue, 28 Oct 2025 19:39:24 +0000 Received: from localhost (localhost [127.0.0.1]) by deimos.limes.com.pl (Postfix) with ESMTP id 98E372512080 for ; Tue, 28 Oct 2025 20:39:19 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at deimos.limes.com.pl X-Spam-Flag: NO X-Spam-Score: -3.025 X-Spam-Level: X-Spam-Status: No, score=-3.025 tagged_above=-9999 required=6.11 tests=[ALL_TRUSTED=-1, AWL=-0.116, BAYES_00=-1.9, HTML_MESSAGE=0.001, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=ham autolearn_force=no Received: from deimos.limes.com.pl ([127.0.0.1]) by localhost (deimos.limes.com.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2FXhKh5mwUKe for ; Tue, 28 Oct 2025 20:39:17 +0100 (CET) Received: from [192.168.51.220] (host141-89-206-34.limes.com.pl [89.206.34.141]) by deimos.limes.com.pl (Postfix) with ESMTPA id 95C152512048 for ; Tue, 28 Oct 2025 20:39:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=limes.com.pl; s=mail; t=1761680357; bh=3khemwkt/pL6mNdoMxkfs0niX/s1V/u27tV2xEd5IbQ=; h=Date:To:From:Subject; b=NloMrhOLtqhV/4x296FbZ6o+nXbMuCyd2jxlQeuBCdwnCZWl0G7FUzYSSx2d3ROXu 7+DvDQOJvjckS1+NUK7g7+6NKrXMGU5ZgKYqHfAqBy7RjV2U+i6NFifNPQtk5mNvdJ wHImxcoxNXc8NO+uFimwmxO7EOQ3mZl3/6cggBxLmYnRVpw65z3uw1/FRdTuCx0ZMp X3x038fbecpKdT3ISJ/lpP9q/JfeuEPfxR5qmHMtsmRungMcbjcckUjciI5faERN6/ kBC8cpM+1urNrBwHRD+dqYhb5LRt+TDt6wkoboS1suFdvDj+zYdXXTTUzedotIwTvj +9F8KNBjyUOTA== Content-Type: multipart/alternative; boundary="------------hF2FG8V3WKa9O1rsyCwvYU0q" Message-ID: Date: Tue, 28 Oct 2025 20:39:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: pgsql-sql@lists.postgresql.org From: Krzysztof Subject: Linux file permission for COPY TO SQL command List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------hF2FG8V3WKa9O1rsyCwvYU0q Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable I try to use COPY TO command to copy results of a SELECT but I get this=20 message: ERROR: =C2=A0could not open file "a file" for writing: Permission denied User, group and other are granted full permission to this file. What=20 should I do more to get this working? --=20 Pozdrawiam Krzysztof Jasie=C5=84ski --------------hF2FG8V3WKa9O1rsyCwvYU0q Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

I try to use COPY TO command to copy results of a SELECT but I get this message:

ERROR: =C2=A0= could not open file "a file" for writing: Permission denied User, group and other are granted full permission to this file. What should I do more to get this working?

--=20
Pozdrawiam
Krzysztof Jasie=C5=84ski
--------------hF2FG8V3WKa9O1rsyCwvYU0q-- From robjsargent@gmail.com Fri May 22 20:26:52 2026 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vDsiu-000QmK-By for pgsql-sql@arkaria.postgresql.org; Tue, 28 Oct 2025 23:03:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vDsir-00Fbaj-Gg for pgsql-sql@arkaria.postgresql.org; Tue, 28 Oct 2025 23:03:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vDsir-00Fbaa-7P for pgsql-sql@lists.postgresql.org; Tue, 28 Oct 2025 23:03:24 +0000 Received: from mail-qv1-xf2c.google.com ([2607:f8b0:4864:20::f2c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vDsin-004mGJ-2d for pgsql-sql@lists.postgresql.org; Tue, 28 Oct 2025 23:03:23 +0000 Received: by mail-qv1-xf2c.google.com with SMTP id 6a1803df08f44-7f7835f4478so46992556d6.1 for ; Tue, 28 Oct 2025 16:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761692599; x=1762297399; darn=lists.postgresql.org; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=AnhBNqHhuvXLmsvrPWYham8uF54OS3/UQgihlozCGeA=; b=WPvkPfRQypUot+RmlxmkPuJfaD1oO/zWWT9bj5LTLE3JC7AkqPygOIniwA1wS1Er5j Mqz5nzJwoYRh6Vdo46T+d1AA5TDuWsT+owFtll0bH4atsNXYFVm6MZXsy0L4+2mX2wnP CmQNdEqkA5Kuw1thhsqKQCukTLxG5IhIuewG8fIKvWIFOcOmDpnQ0tZ6F6oHpk+BulO5 9xKHTq432091tTcg3dlFBGxYHVg1bhdNZkwDAxSuDjmUx8aybz2eTR0rEPfBdARXiXkM ZNZnQ3y80+qoW7M9ijZtRbjnIWc9R3NSIiwrW/XjNlcnp3DunNNSskeJs8aTsrcTwkpN fm2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761692599; x=1762297399; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AnhBNqHhuvXLmsvrPWYham8uF54OS3/UQgihlozCGeA=; b=H8DJyaA739cTI9xQcj3XaZ+yyADxjAqt53aEiA3Q8q3ox/RAQ4GjXYudq4mzCuiRFs FoDsjQ1TUMehhgSYSEDCG5/ib3xVmYSO1XVmCJTcX6abDOUXWoEFh3MM6LHHG3U4Sn13 Jus3qkBV/vtC4klsi5ccBjd9wE14ClhwqGEhqo5a4SDLtlN27iS0v3L5T76e8b84fyX5 3KBzyIV0rjiiqaCGwMpzZoKsJoL9h/u7fynxuwGPXPxRYkUtivw+xaM+Q7+HYnQYPA4O /WUT0flHZCUFqBvT/4qpmgTWznWeLFS/pDbaRiDqQPV3atPSaSZ0l2NlofrhOq7rhEis H90A== X-Gm-Message-State: AOJu0YwVokJfmoh1ya36tB9KpVYTcRezyuqpJmojDK7e4kgxC583Lx1Q Gw+iHUHZJ/AKoQILfaIFtMBjoJXahXkYzYivcr/6vmnNlnskAWPkDMRIfBdueg== X-Gm-Gg: ASbGncvhktWiT9UYPWuDs+dJT6z49Jmzzv/MTKoQPEsyJuphWCJNyCm1d8sMD8uPygn TYqbCCoQF0HKBEba6uTLF1YTJNdLqG+tbDPt4deirVJSOQeJblXNm6ntyUn58x96ciZc9R2W5OK RShhGAMlWBhEQEHs94YHAsFe6xYETg61oF2qxNiAyE9RWFLzJCa+W43o+UjWktechzyfm96zQX4 lHVQGeNM1AtddXJIs9NDyG3IaxaG8yyemXvwRhidGvWbz/p3TjYG7DO0B1aiEgt88NfR0FpzlDG XeK1C5K6xhlmZVPalSdu3Ddiy6Am/UBdPEvVz13WMdVwkE2fKbvHPDJvlmtE+vTUYwDMlATAHjW aWuywEdtOeD2a4j0xH7RVFWRBDX0ocpJ20HqmUjWNodRK0pClfX52EUVm9YdSNQumA3ptWAotXn tqeVkuuIy18jNpkPxy6wasq62XnXD67b3gwuFpGUw9Jh+G0/5sHajqiSLx X-Google-Smtp-Source: AGHT+IE9xWc3TGpC2frQp1QF+BuEZsd+KNU2GxB0Rmw9NRPm+7rFDc6GftZAzsUmSqffFeQ7sHNeVg== X-Received: by 2002:a05:6214:3015:b0:87c:21ce:3868 with SMTP id 6a1803df08f44-88009bda102mr13286686d6.34.1761692599403; Tue, 28 Oct 2025 16:03:19 -0700 (PDT) Received: from smtpclient.apple (ec2-3-81-4-231.compute-1.amazonaws.com. [3.81.4.231]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-87fc49a3984sm85689726d6.50.2025.10.28.16.03.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Oct 2025 16:03:18 -0700 (PDT) Content-Type: multipart/alternative; boundary=Apple-Mail-871FE16D-84E7-42B0-B0DC-CDC070C35D51 Content-Transfer-Encoding: 7bit From: Rob Sargent Mime-Version: 1.0 (1.0) Subject: Re: Linux file permission for COPY TO SQL command Date: Tue, 28 Oct 2025 13:03:07 -1000 Message-Id: <8ABD45BB-37B7-4394-AB59-10BC1C25797F@gmail.com> References: Cc: pgsql-sql@lists.postgresql.org In-Reply-To: To: Krzysztof X-Mailer: iPhone Mail (22G100) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail-871FE16D-84E7-42B0-B0DC-CDC070C35D51 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > On Oct 28, 2025, at 9:39=E2=80=AFAM, Krzysztof wrote: >=20 > =EF=BB=BF > I try to use COPY TO command to copy results of a SELECT but I get this me= ssage: >=20 > ERROR: could not open file "a file" for writing: Permission denied >=20 >=20 Is there really a space in the actual file name. That might get tricky. You=E2= =80=99re suggesting the file already exists: is that true? Directory permiss= ions? > User, group and other are granted full permission to this file. What shoul= d I do more to get this working? >=20 > --=20 > Pozdrawiam > Krzysztof Jasie=C5=84ski --Apple-Mail-871FE16D-84E7-42B0-B0DC-CDC070C35D51 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

On Oct 28, 2025, at 9:= 39=E2=80=AFAM, Krzysztof <kj@limes.com.pl> wrote:

=
=EF=BB=BF =20 =20 =20

I try to use COPY TO command to copy results of a SELECT but I get this message:

ERROR:  could not open file "a file" for writing: Permission denied

<= /span>


Is there really a space in the a= ctual file name. That might get tricky. You=E2=80=99re suggesting the file a= lready exists: is that true? Directory permissions?

User, group and other are granted full permission to this file. What should I do more to get this working?

--=20
Pozdrawiam
Krzysztof Jasie=C5=84ski
=20
= --Apple-Mail-871FE16D-84E7-42B0-B0DC-CDC070C35D51-- From rolmur@gmail.com Fri May 22 20:26:52 2026 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vE8nL-0066dU-Ro for pgsql-sql@arkaria.postgresql.org; Wed, 29 Oct 2025 16:13:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vE8nK-002DLG-Lu for pgsql-sql@arkaria.postgresql.org; Wed, 29 Oct 2025 16:13:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vE8nK-002DL7-8q for pgsql-sql@lists.postgresql.org; Wed, 29 Oct 2025 16:13:05 +0000 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vE8nH-004PaC-21 for pgsql-sql@lists.postgresql.org; Wed, 29 Oct 2025 16:13:04 +0000 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-378cfd75fb0so79262081fa.1 for ; Wed, 29 Oct 2025 09:13:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761754382; x=1762359182; darn=lists.postgresql.org; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=oYv4ROscdA57XNU5rRoXAnu/31GQIhLhqM0qIDxDcbg=; b=d9BrPvtmdu275HpnFcaWFcCsiVqsxUoCCYTw10822GYDrkSMH+23yaqYdhiO4+jb3C z7KRgFd5tQnTQ4CCaMAmrArFI/QbWwe+rr4yX0XpfZymX1ICtc/jGTXwyIO97cO51kRu wwQ1D+rKdyLr8UIejVx6dGE5lPVEqBCtGSGZ5ZirG3/n23MIJdwCDy+8h/4B3XjXMVru psauWNzGf0T47pGAc6BGsPTeZOgwVoz95nG6P2n6O1aKwpmsic17zNBS798aQL1Mk4DI 57QgqumJl29tP8jG0EmacXYssi757/1ZxLi6T7xp6EoikGaSH0bby8zeJAUz2M7rNDru HLhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761754382; x=1762359182; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=oYv4ROscdA57XNU5rRoXAnu/31GQIhLhqM0qIDxDcbg=; b=ix7PJq7jq2cXdN2hn6TvxT6ap1VrB6beXxY3RSXNJJLmjtCUXwuGwTMhZpKB/OHt5A p7dolpZxZf2nnBEjlm9/6jwsbVjehsZjBW4OfKQqg4CB6AetNM1Z+1elMP875xMdT1V/ zQGkTQyjuqE1Uagk7O7Bl0Kxb4Wvhcewy+nBU7gzkSkKJXVPnldbGBKFCOdp9Ntyt2Xg FzHAyoUNERMTNSVowabzc7aQTW3TIE/sH/OB3tknwCjU4PzI6yLJXNDklDVPcUiXssj/ qqLzZxc64CmsfREttPRcyRpGMuVxCykOUZuYUUQs+PhhHh59Sm0ADpn3KzbH/VqoYlur p4VA== X-Gm-Message-State: AOJu0YyfDlNvEvqzNyffqh+msq57yLOSnEH3t3l4RmCHKsd1w22CQK2A jubycftgUuSz2OmjNgorG0xQUcN9E60bcBwGp3xLagqFWkyxUA8HsXV6NYjpWw== X-Gm-Gg: ASbGnctVfiBB56i0FotvOQryP5O87cdOiXM4xOu2cUzgOXAtmGtGawxvgHtT8CXSLVE lPw1jpeRIXtneK8F1eOcptZ7f/4Ud/GFSc4C8zQWJuXiSwEfdXX+2KdIZ3RpZRNZag0zhioawh3 lQnXOlY5U2hrtQ7cxrLoVr4TahoENS9/QGV0Z6BNjzmpIJA+eOrn8ZvanZxfANq2FHPMaBjfGHd eQ6wjcnQUddD+McEl4Z59pgfQEiSnU/+11S/D1/+BFelUffQdVreAbMOvdoWQp+4bVYHVGlOg0T GPQi7l5CyBELmoaZCzNFLWpLdMlqxAytM5xNmtpVWYPcs27tPf2Rl9hEdT9MALoAjr1BnR52kXy JtvYcSKdA7lznc0ZjJRv3QZVPj+99dBddrdcLMjmj9er7kxTzXEGhwt1LvHeyiwdtv+ZrutfMCe 2k72XmKju4mXg0/rzEeKeU73FIKgTlasergzydGjHt8jde8bhsWWE= X-Google-Smtp-Source: AGHT+IH9wL6ZKLATBgUnhqngC6hayqtQJPWIif3kmY1alZe67du8nUou2R1C24Kwhy8RhPX8jdKIXQ== X-Received: by 2002:a05:651c:1603:b0:378:cff9:93f with SMTP id 38308e7fff4ca-37a1093a6aamr129741fa.12.1761754381722; Wed, 29 Oct 2025 09:13:01 -0700 (PDT) Received: from [10.96.240.181] (mobile-access-b04858-250.dhcp.inet.fi. [176.72.88.250]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-378ee0e505bsm34302591fa.52.2025.10.29.09.13.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Oct 2025 09:13:01 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------6l00JYm71nhPVmghUfgaBXce" Message-ID: <7d2f7e34-c724-4227-a1c2-8d5882a6a3d4@gmail.com> Date: Wed, 29 Oct 2025 18:12:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Linux file permission for COPY TO SQL command To: pgsql-sql@lists.postgresql.org References: <8ABD45BB-37B7-4394-AB59-10BC1C25797F@gmail.com> Content-Language: en-US From: =?UTF-8?Q?Roland_M=C3=BCller?= In-Reply-To: <8ABD45BB-37B7-4394-AB59-10BC1C25797F@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------6l00JYm71nhPVmghUfgaBXce Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hello, COPY TO  stores the output into a file on the server rather than in your local where client is running. Spaces in the file name are actually no issue: $ psql -h 172.17.0.2 -U postgres -c "COPY (SELECT * FROM pg_class) TO '/var/tmp/pg_class.       OUT  x'" Password for user postgres: COPY 420 ... but the output file is on the server - in this example inside a docker container postgres@7680e256387f:~$ ls -ltr /var/tmp total 208 ... -rw-r--r-- 1 postgres postgres 49291 Oct 29 16:08 'pg_class.  OUT  x' Copying to client side can be done with \copy () to ''; BR/Pozdrawiam, Roland On 10/29/25 01:03, Rob Sargent wrote: > > >> On Oct 28, 2025, at 9:39 AM, Krzysztof wrote: >> >>  >> >> I try to use COPY TO command to copy results of a SELECT but I get >> this message: >> >> ERROR:  could not open file "a file" for writing: Permission denied >> > > Is there really a space in the actual file name. That might get > tricky. You’re suggesting the file already exists: is that true? > Directory permissions? >> >> User, group and other are granted full permission to this file. What >> should I do more to get this working? >> >> -- >> Pozdrawiam >> Krzysztof Jasieński --------------6l00JYm71nhPVmghUfgaBXce Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hello,


COPY TO  stores the output into a file on the server rather than in your local where client is running.


Spaces in the file name are actually no issue:

$ psql -h 172.17.0.2 -U postgres -c "COPY (SELECT * FROM pg_class) TO '/var/tmp/pg_class.       OUT  x'"
Password for user postgres: 
COPY 420

... but the output file is on the server - in this example inside a docker container

postgres@7680e256387f:~$ ls -ltr /var/tmp
total 208
...
-rw-r--r-- 1 postgres postgres 49291 Oct 29 16:08 'pg_class.       OUT  x'


Copying to client side can be done with \copy (<query or table>) to '<output file>';


BR/Pozdrawiam,

Roland


On 10/29/25 01:03, Rob Sargent wrote:


On Oct 28, 2025, at 9:39 AM, Krzysztof <kj@limes.com.pl> wrote:



I try to use COPY TO command to copy results of a SELECT but I get this message:

ERROR:  could not open file "a file" for writing: Permission denied


Is there really a space in the actual file name. That might get tricky. You’re suggesting the file already exists: is that true? Directory permissions?

User, group and other are granted full permission to this file. What should I do more to get this working?

-- 
Pozdrawiam
Krzysztof Jasieński
--------------6l00JYm71nhPVmghUfgaBXce-- From kj@limes.com.pl Fri May 22 20:26:52 2026 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vEBAe-006lke-GI for pgsql-sql@arkaria.postgresql.org; Wed, 29 Oct 2025 18:45:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vEB9e-0030kG-V3 for pgsql-sql@arkaria.postgresql.org; Wed, 29 Oct 2025 18:44:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vEB9e-0030k7-Gc for pgsql-sql@lists.postgresql.org; Wed, 29 Oct 2025 18:44:17 +0000 Received: from deimos.limes.com.pl ([193.110.228.48]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vEB9b-004vpf-0E for pgsql-sql@lists.postgresql.org; Wed, 29 Oct 2025 18:44:17 +0000 Received: from localhost (localhost [127.0.0.1]) by deimos.limes.com.pl (Postfix) with ESMTP id 038322512080 for ; Wed, 29 Oct 2025 19:44:09 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at deimos.limes.com.pl X-Spam-Flag: NO X-Spam-Score: -3.026 X-Spam-Level: X-Spam-Status: No, score=-3.026 tagged_above=-9999 required=6.11 tests=[ALL_TRUSTED=-1, AWL=-0.117, BAYES_00=-1.9, HTML_MESSAGE=0.001, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=ham autolearn_force=no Received: from deimos.limes.com.pl ([127.0.0.1]) by localhost (deimos.limes.com.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tQAJs9qpeVUe for ; Wed, 29 Oct 2025 19:44:06 +0100 (CET) Received: from [192.168.51.220] (host141-89-206-34.limes.com.pl [89.206.34.141]) by deimos.limes.com.pl (Postfix) with ESMTPA id A3798251207E for ; Wed, 29 Oct 2025 19:44:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=limes.com.pl; s=mail; t=1761763446; bh=57XEr5rL4vBZuIs8eguVQr1kv8BqKrdLcKtWxReFdtM=; h=Date:Subject:To:References:From:In-Reply-To; b=gq8FZaFTRBrfuWTugJfkqW/ltPPJzrSBTqso4nGS/hb9Zhlbjh1hDjmHG9q8ZTS6W yI6y6XUB33RyDOiESyYn1RYkCzeGUoYgd7uFt0zbs81UZhTFOhM/fuW7c2/oLU2dB7 6sWOzjkyTOT3Sv9afGh9IA0cZothLwjnUD3R3Bfbghe4eABrXoPfzbLn+UEepT+NfX Y3OVP3EPY/1ZvzmP1baz2XR1wa0+sX3/28R1PmYVq3UAtV1gr7u/+4mv0wgzZvA1Tb c2cIcwLawbokKQFpBXxqAwWbdN7sbeV+xSTGzR5FxMbVSVnMCNl5yd+/b0iN/R77Nk TFgEcu4KMFrAw== Content-Type: multipart/alternative; boundary="------------VgAGNcq3ZdUGb0ZWOYDeVKxO" Message-ID: Date: Wed, 29 Oct 2025 19:44:01 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Linux file permission for COPY TO SQL command To: pgsql-sql@lists.postgresql.org References: <8ABD45BB-37B7-4394-AB59-10BC1C25797F@gmail.com> <7d2f7e34-c724-4227-a1c2-8d5882a6a3d4@gmail.com> Content-Language: en-US From: Krzysztof In-Reply-To: <7d2f7e34-c724-4227-a1c2-8d5882a6a3d4@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------VgAGNcq3ZdUGb0ZWOYDeVKxO Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Actually server and client are installed on the same machine. The file (real file) permissions are as follows: -rwxrwxrwx+ 1 kaj kaj 2 Oct 27 22:36 fd/fdo.txt The directory permissions are as follows: drwxrwxrwx+  4 kaj kaj     4096 Oct 27 22:36 fd The SQL command which tries to write to the file is this: copy (select key from xcg where add=false) to '/home/kaj/fd/fdo.txt'; Pozdrawiam Krzysztof Jasieński On 10/29/25 5:12 PM, Roland Müller wrote: > > Hello, > > > COPY TO  stores the output into a file on the server rather than in > your local where client is running. > > > Spaces in the file name are actually no issue: > > $ psql -h 172.17.0.2 -U postgres -c "COPY (SELECT * FROM pg_class) TO > '/var/tmp/pg_class.       OUT  x'" > Password for user postgres: > COPY 420 > > ... but the output file is on the server - in this example inside a > docker container > > postgres@7680e256387f:~$ ls -ltr /var/tmp > total 208 > ... > -rw-r--r-- 1 postgres postgres 49291 Oct 29 16:08 'pg_class.    OUT  x' > > > Copying to client side can be done with \copy () to > ''; > > > BR/Pozdrawiam, > > Roland > > > On 10/29/25 01:03, Rob Sargent wrote: >> >> >>> On Oct 28, 2025, at 9:39 AM, Krzysztof wrote: >>> >>>  >>> >>> I try to use COPY TO command to copy results of a SELECT but I get >>> this message: >>> >>> ERROR:  could not open file "a file" for writing: Permission denied >>> >> >> Is there really a space in the actual file name. That might get >> tricky. You’re suggesting the file already exists: is that true? >> Directory permissions? >>> >>> User, group and other are granted full permission to this file. What >>> should I do more to get this working? >>> >>> -- >>> Pozdrawiam >>> Krzysztof Jasieński --------------VgAGNcq3ZdUGb0ZWOYDeVKxO Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Actually server and client are installed on the same machine.

The file (real file) permissions are as follows:

-rwxrwxrwx+ 1 kaj kaj 2 Oct 27 22:36 fd/fdo.txt

The directory permissions are as follows:

drwxrwxrwx+  4 kaj kaj     4096 Oct 27 22:36 fd

The SQL command which tries to write to the file is this:

copy (select key from xcg where add=false) to '/home/kaj/fd/fdo.txt';


Pozdrawiam
Krzysztof Jasieński
On 10/29/25 5:12 PM, Roland Müller wrote:

Hello,


COPY TO  stores the output into a file on the server rather than in your local where client is running.


Spaces in the file name are actually no issue:

$ psql -h 172.17.0.2 -U postgres -c "COPY (SELECT * FROM pg_class) TO '/var/tmp/pg_class.       OUT  x'"
Password for user postgres: 
COPY 420

... but the output file is on the server - in this example inside a docker container

postgres@7680e256387f:~$ ls -ltr /var/tmp
total 208
...
-rw-r--r-- 1 postgres postgres 49291 Oct 29 16:08 'pg_class.       OUT  x'


Copying to client side can be done with \copy (<query or table>) to '<output file>';


BR/Pozdrawiam,

Roland


On 10/29/25 01:03, Rob Sargent wrote:


On Oct 28, 2025, at 9:39 AM, Krzysztof <kj@limes.com.pl> wrote:



I try to use COPY TO command to copy results of a SELECT but I get this message:

ERROR:  could not open file "a file" for writing: Permission denied


Is there really a space in the actual file name. That might get tricky. You’re suggesting the file already exists: is that true? Directory permissions?

User, group and other are granted full permission to this file. What should I do more to get this working?

-- 
Pozdrawiam
Krzysztof Jasieński
--------------VgAGNcq3ZdUGb0ZWOYDeVKxO-- From tgl@sss.pgh.pa.us Fri May 22 20:26:52 2026 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vECH6-0077RI-U2 for pgsql-sql@arkaria.postgresql.org; Wed, 29 Oct 2025 19:56:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vECH4-003WP0-K5 for pgsql-sql@arkaria.postgresql.org; Wed, 29 Oct 2025 19:56:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vECH4-003WOs-BW for pgsql-sql@lists.postgresql.org; Wed, 29 Oct 2025 19:56:01 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vECH1-004RLv-2H for pgsql-sql@lists.postgresql.org; Wed, 29 Oct 2025 19:56:00 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 59TJtrlk2892302; Wed, 29 Oct 2025 15:55:53 -0400 From: Tom Lane To: Krzysztof cc: pgsql-sql@lists.postgresql.org Subject: Re: Linux file permission for COPY TO SQL command In-reply-to: References: <8ABD45BB-37B7-4394-AB59-10BC1C25797F@gmail.com> <7d2f7e34-c724-4227-a1c2-8d5882a6a3d4@gmail.com> Comments: In-reply-to Krzysztof message dated "Wed, 29 Oct 2025 19:44:01 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2892300.1761767753.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 29 Oct 2025 15:55:53 -0400 Message-ID: <2892301.1761767753@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Krzysztof writes: > Actually server and client are installed on the same machine. > The file (real file) permissions are as follows: > -rwxrwxrwx+ 1 kaj kaj 2 Oct 27 22:36 fd/fdo.txt > The directory permissions are as follows: > drwxrwxrwx+ =C2=A04 kaj kaj =C2=A0=C2=A0=C2=A0=C2=A04096 Oct 27 22:36 fd > The SQL command which tries to write to the file is this: > copy (select key from xcg where add=3Dfalse) to '/home/kaj/fd/fdo.txt'; The /home and /home/kaj directories would also need to be world-searchable for the server to be able to write there. (Do not make them world-writable...) Did you notice the HINT that goes with that error message? HINT: COPY TO instructs the PostgreSQL server process to write a file. Yo= u may want a client-side facility such as psql's \copy. regards, tom lane From rolmur@gmail.com Fri May 22 20:26:52 2026 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vECW0-007Doj-AA for pgsql-sql@arkaria.postgresql.org; Wed, 29 Oct 2025 20:11:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vECVz-003YKr-3O for pgsql-sql@arkaria.postgresql.org; Wed, 29 Oct 2025 20:11:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vECVy-003YKj-QQ for pgsql-sql@lists.postgresql.org; Wed, 29 Oct 2025 20:11:25 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vECVv-004wTJ-1y for pgsql-sql@lists.postgresql.org; Wed, 29 Oct 2025 20:11:25 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-37775ed97daso14554371fa.0 for ; Wed, 29 Oct 2025 13:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761768682; x=1762373482; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=IgoGi04hkuXzjOGnibwmtTwpVpVLBhlNNq741sMSqRQ=; b=ZlVqoXIDL3wHB6J6bEoO9+7fzsZGrw4M3y1tppx8oydOJbpqpA3fXZ6kPUUVpRmroq YvhRz1ffOYzXliSKiAbqH2BtloysV1wmbAEahfxQaRQUUpSa0lYff+A1817JYD+eTjtX PqMEWY44VjHfKv0YL7zfuXvRq0IHiJ7NLuUKTSVjMunprJsJSbGACKZYIDA+lp0zdxo7 BMmucSwb1hdI9tZnJSA4MVJ3shJvvlDxOGhR39EdYeHdOKCzW4P6rgi4i+26tqB2zkSV Nh+KsPytN++70j3HuRa7H15IQ/MKhqZR3eH3lfbj/vSOXY9+K0/wGxfaGubaQqPrL095 6doQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761768682; x=1762373482; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IgoGi04hkuXzjOGnibwmtTwpVpVLBhlNNq741sMSqRQ=; b=rE4z8G75/f0WMYM01D5VSmoJPajBaLbOd4P8ETt33oS1wuELb4/ZVGmGBc9p7aKM0g hxjwFiCwvtZSI/tZYHu0FINdu2G2hfTWmeaz0VB/D90vBAlraqSij2RGrCaHEXwDt23M slXPT7MvkqJwfkGAalOgXfVUgCkrQtXhwLgse11H94joZ/cxi9uzkLqV9rEHRPGre0bH s7Ivnb9z3cqYGP6JVgCe1uYLIJh057ArOeOGtCTiBp6qUgXjeGu+gwp/zyuKWZMjH6Sl p9coHySpbApkJA4bc1WccICWBC20U+YhKWNROH3emTR2FDC5woTlHzY5iLF6rqpA2e5o QQAg== X-Gm-Message-State: AOJu0Yx2IZS9hOdznL9ImwncGIgN7TdVaCGSxdy34fjVnCd/hj0yOAU1 wil6s2/oRI1YETfcYFKEtFb1zhzOWpbGKUVM4Rap+PUxkoXF44vyFdqmEy180g== X-Gm-Gg: ASbGncswh83QYDVvvzWbFlXrrm/e0y5NmkZABCrQpen2ppVfwq9miBn4CE3Q0HFvpJQ TkC2J91IU7y55mbHZqzQdUrcI2zHP5V12QOhDS9bhf7OChcY4nqNMpjySaWG0gLD8988UYhblCu EZHgykBpGLvaQ6l/34LJfCqAUzmG5KZHZQI9kFQIWqUHbnNAoO9qOUdSJZ8Lo/pTO/df9LOPRaC Mi5UwvAf76zo+yTgq2SfJF8H/1bZBpNMF9l2cYlSAI4cNi8g8G8mKyFbcAIKAvMWDWNIrokZPvk WZfi006GzQLUMreDHlgvPoAHQR6swlIwMgU4PTenYbx2maBeFP4yDM2shprqH5efgWhPkC3iHPk RvAyMgta0HMXspV2xuSjVykf4gpQhSLn9IH8wQEEFSl1EDYRCODSG53q758dilQGrrbb+rCBnfY kmVQfYjjDVLZlnsNmBMr2f8NjjkMmxF0/gIgCfm9/6eZ85IfM1ArQ= X-Google-Smtp-Source: AGHT+IEKxb0M7maoGpx/RiMT0FhGt753M0U76sYSisy4o7s24Pcyr8H6ICzt+Fi34D6LxuLRgCrRDw== X-Received: by 2002:a2e:a363:0:b0:377:c556:68b7 with SMTP id 38308e7fff4ca-37a106d7154mr1905471fa.17.1761768682250; Wed, 29 Oct 2025 13:11:22 -0700 (PDT) Received: from [10.96.240.181] (mobile-access-b04858-250.dhcp.inet.fi. [176.72.88.250]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-378ee09cc0fsm37147611fa.12.2025.10.29.13.11.20 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Oct 2025 13:11:20 -0700 (PDT) Message-ID: <7f2d2a9e-f135-4147-8781-417ad09b7360@gmail.com> Date: Wed, 29 Oct 2025 22:11:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Linux file permission for COPY TO SQL command To: pgsql-sql@lists.postgresql.org References: <8ABD45BB-37B7-4394-AB59-10BC1C25797F@gmail.com> <7d2f7e34-c724-4227-a1c2-8d5882a6a3d4@gmail.com> <2892301.1761767753@sss.pgh.pa.us> Content-Language: en-US From: =?UTF-8?Q?Roland_M=C3=BCller?= In-Reply-To: <2892301.1761767753@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I think the best solution is to use the psql '\copy' that works the same way as server-side COPY or COPY TO. in addition, the output is always stored in the client machine regardless whetehr the server is in localhost, remote or inside a container. postgres=# \copy (SELECT * FROM pg_class) to /home/MYACCOUNT/Desktop/OUT COPY 420 postgres=# \! ls -ltr /home/MYACCOUNT/Desktop/OUT -rw-rw-r-- 1 MYACCOUNT MYACCOUNT 49291 Oct 29 22:06 /home/MYACCOUNT/Desktop/OUT On 10/29/25 21:55, Tom Lane wrote: > Krzysztof writes: >> Actually server and client are installed on the same machine. >> The file (real file) permissions are as follows: >> -rwxrwxrwx+ 1 kaj kaj 2 Oct 27 22:36 fd/fdo.txt >> The directory permissions are as follows: >> drwxrwxrwx+  4 kaj kaj     4096 Oct 27 22:36 fd >> The SQL command which tries to write to the file is this: >> copy (select key from xcg where add=false) to '/home/kaj/fd/fdo.txt'; > The /home and /home/kaj directories would also need to be > world-searchable for the server to be able to write there. > (Do not make them world-writable...) > > Did you notice the HINT that goes with that error message? > > HINT: COPY TO instructs the PostgreSQL server process to write a file. You may want a client-side facility such as psql's \copy. > > regards, tom lane > > From kj@limes.com.pl Fri May 22 20:26:52 2026 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vFftn-00GHuc-9Y for pgsql-sql@arkaria.postgresql.org; Sun, 02 Nov 2025 21:46:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vFftk-00ERcW-4k for pgsql-sql@arkaria.postgresql.org; Sun, 02 Nov 2025 21:46:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vFftj-00ERcN-SW for pgsql-sql@lists.postgresql.org; Sun, 02 Nov 2025 21:46:02 +0000 Received: from deimos.limes.com.pl ([193.110.228.48]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vFftg-005dZI-0I for pgsql-sql@lists.postgresql.org; Sun, 02 Nov 2025 21:46:02 +0000 Received: from localhost (localhost [127.0.0.1]) by deimos.limes.com.pl (Postfix) with ESMTP id 120BA251207D for ; Sun, 2 Nov 2025 22:45:54 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at deimos.limes.com.pl X-Spam-Flag: NO X-Spam-Score: -3.027 X-Spam-Level: X-Spam-Status: No, score=-3.027 tagged_above=-9999 required=6.11 tests=[ALL_TRUSTED=-1, AWL=-0.117, BAYES_00=-1.9, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=ham autolearn_force=no Received: from deimos.limes.com.pl ([127.0.0.1]) by localhost (deimos.limes.com.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id C-yJY52D8uOV for ; Sun, 2 Nov 2025 22:45:52 +0100 (CET) Received: from [192.168.51.220] (host141-89-206-34.limes.com.pl [89.206.34.141]) by deimos.limes.com.pl (Postfix) with ESMTPA id EC6E52512078 for ; Sun, 2 Nov 2025 22:45:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=limes.com.pl; s=mail; t=1762119951; bh=MNCiWquFo0dgpYjxCXG8TdR4Kl6L5N776sfe5wEDHnQ=; h=Date:Subject:To:References:From:In-Reply-To; b=Hh80xPa+lsbqBycT/JaBaEnwQIlSRENkU3YeriVRa1wCqKu660DuOGUo2F1Nzae5G osWJT6j/0kr5kWX8mtflnlw0AWOWZwCxdzxH/+2Oc4BCxRHu+dD6Ph1fxuDMnH7iJt aB2xq6s6ABz1PRmzhh/4evExP4xLg/BaAtzdcJac6kQcwY7i1FqQgdvfuFVi3ZlUqq Pr87RgXCGGIG59Q638FBhQBiFWWP7jR0QyZdFIDuKloDO5MnKcAZXxC1l5nv1GA9pS xpPbN/L8dV8E2uF9n8skKyAwDRLFlFu98+JqRBC2m0dyUt4lvJTf3Ke7Pm7WtHAAhu kCPmBBD7TDGcQ== Message-ID: <5d47fc08-0360-4c08-9051-f6ed424ff61d@limes.com.pl> Date: Sun, 2 Nov 2025 22:45:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Linux file permission for COPY TO SQL command To: pgsql-sql@lists.postgresql.org References: <8ABD45BB-37B7-4394-AB59-10BC1C25797F@gmail.com> <7d2f7e34-c724-4227-a1c2-8d5882a6a3d4@gmail.com> <2892301.1761767753@sss.pgh.pa.us> Content-Language: en-US From: Krzysztof In-Reply-To: <2892301.1761767753@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk That helped. Thanks. Pozdrawiam Krzysztof Jasieński On 10/29/25 8:55 PM, Tom Lane wrote: > The /home and /home/kaj directories would also need to be > world-searchable for the server to be able to write there. > (Do not make them world-writable...) > > Did you notice the HINT that goes with that error message? > > HINT: COPY TO instructs the PostgreSQL server process to write a file. You may want a client-side facility such as psql's \copy. > > regards, tom lane > >