public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH v16 02/10] pg_stat_file and pg_ls_dir_* to use lstat()..
5+ messages / 5 participants
[nested] [flat]

* [PATCH v16 02/10] pg_stat_file and pg_ls_dir_* to use lstat()..
@ 2020-03-30 23:59  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 5+ messages in thread

From: Justin Pryzby @ 2020-03-30 23:59 UTC (permalink / raw)

pg_ls_dir_* will now skip (no longer show) symbolic links, same as other
non-regular file types, as we advertize we do since 8b6d94cf6.  That seems to
be the intented behavior, since irregular file types are 1) less portable; and,
2) we don't currently show a file's type except for "bool is_dir".

pg_stat_file will now 1) show metadata of links themselves, rather than their
target; and, 2) specifically, show links to directories with "is_dir=false";
and, 3) not error on broken symlinks.
---
 doc/src/sgml/func.sgml          | 2 +-
 src/backend/utils/adt/genfile.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 9b885102da..96b08d0500 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -25486,7 +25486,7 @@ SELECT convert_from(pg_read_binary_file('file_in_utf8.txt'), 'UTF8');
     size, last accessed time stamp, last modified time stamp,
     last file status change time stamp (Unix platforms only),
     file creation time stamp (Windows only), and a <type>boolean</type>
-    indicating if it is a directory (or a symbolic link to a directory).
+    indicating if it is a directory.
     Typical usages include:
 <programlisting>
 SELECT * FROM pg_stat_file('filename');
diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c
index ceaa6180da..219ac160f8 100644
--- a/src/backend/utils/adt/genfile.c
+++ b/src/backend/utils/adt/genfile.c
@@ -370,7 +370,7 @@ pg_stat_file(PG_FUNCTION_ARGS)
 
 	filename = convert_and_check_filename(filename_t);
 
-	if (stat(filename, &fst) < 0)
+	if (lstat(filename, &fst) < 0)
 	{
 		if (missing_ok && errno == ENOENT)
 			PG_RETURN_NULL();
@@ -596,7 +596,7 @@ pg_ls_dir_files(FunctionCallInfo fcinfo, const char *dir, bool missing_ok)
 
 		/* Get the file info */
 		snprintf(path, sizeof(path), "%s/%s", dir, de->d_name);
-		if (stat(path, &attrib) < 0)
+		if (lstat(path, &attrib) < 0)
 		{
 			/* Ignore concurrently-deleted files, else complain */
 			if (errno == ENOENT)
-- 
2.17.0


--2FkSFaIQeDFoAt0B
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="v16-0003-Add-tests-on-pg_ls_dir-before-changing-it.patch"



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [PATCH] psql: Add tab-complete for optional view parameters
@ 2023-01-11 22:29  Thomas Munro <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Thomas Munro @ 2023-01-11 22:29 UTC (permalink / raw)
  To: vignesh C <[email protected]>; +Cc: Christoph Heiss <[email protected]>; Melih Mutlu <[email protected]>; pgsql-hackers

On Thu, Jan 12, 2023 at 5:50 AM vignesh C <[email protected]> wrote:
> For some reason CFBot is not able to apply the patch, please have a
> look and post an updated version if required, also check and handle
> Dean Rasheed and Jim Jones  comment if applicable:
> === Applying patches on top of PostgreSQL commit ID
> 5f6401f81cb24bd3930e0dc589fc4aa8b5424cdc ===
> === applying patch
> ./v2-0001-psql-Add-tab-complete-for-optional-view-parameter.patch
> gpatch: **** Only garbage was found in the patch input.

Melanie pointed me at this issue.  This particular entry is now fixed,
and I think I know what happened:  cfbot wasn't checking the HTTP
status when downloading patches from the web archives, because I had
incorrectly assumed Python's requests.get() would raise an exception
if the web server sent an error status, but it turns out you have to
ask for that.  I've now fixed that.  So I think it was probably trying
to apply one of those "guru meditation" error message the web archives
occasionally spit out.






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [PATCH] psql: Add tab-complete for optional view parameters
@ 2023-01-29 10:19  Mikhail Gribkov <[email protected]>
  parent: Thomas Munro <[email protected]>
  0 siblings, 2 replies; 5+ messages in thread

From: Mikhail Gribkov @ 2023-01-29 10:19 UTC (permalink / raw)
  To: [email protected]; +Cc: Christoph Heiss <[email protected]>

The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, failed
Documentation:            tested, passed

Hi Christoph,

The patch have a potential, although I have to agree with Jim Jones, it obviously have a problem with "alter view <name> set<tab>" handling.

First of all user can notice, that SET and RESET alternatives are proposed in an absolutely equivalent way:
postgres=# alter view VVV <tab>
ALTER COLUMN  OWNER TO      RENAME        RESET (       SET (         SET SCHEMA

But completion of a parentheses differs fore these alternatives:

postgres=# alter view VVV reset<tab> -> completes with "<space>(" -> <tab>
CHECK_OPTION      SECURITY_BARRIER  SECURITY_INVOKER

postgres=# alter view VVV set<tab> -> completes with a single spase -> <tab>
Display all 188 possibilities? (y or n)
(and these 188 possibilities do not contain "(")

The probmen is obviously in the newly added second line of the following clause:
		COMPLETE_WITH("ALTER COLUMN", "OWNER TO", "RENAME",
					  "SET SCHEMA", "SET (", "RESET (");

"set schema" and "set (" alternatives are competing, while completion of the common part "set<space>" leads to a string composition which does not have the check branch (Matches("ALTER", "VIEW", MatchAny, "SET")).

I think it may worth looking at "alter materialized view"  completion tree and making "alter view" the same way.

The new status of this patch is: Waiting on Author


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [PATCH] psql: Add tab-complete for optional view parameters
@ 2023-03-20 18:40  Gregory Stark (as CFM) <[email protected]>
  parent: Mikhail Gribkov <[email protected]>
  1 sibling, 0 replies; 5+ messages in thread

From: Gregory Stark (as CFM) @ 2023-03-20 18:40 UTC (permalink / raw)
  To: Mikhail Gribkov <[email protected]>; +Cc: [email protected]; Christoph Heiss <[email protected]>

On Sun, 29 Jan 2023 at 05:20, Mikhail Gribkov <[email protected]> wrote:
>
> The problem is obviously in the newly added second line of the following clause:
>                 COMPLETE_WITH("ALTER COLUMN", "OWNER TO", "RENAME",
>                                           "SET SCHEMA", "SET (", "RESET (");
>
> "set schema" and "set (" alternatives are competing, while completion of the common part "set<space>" leads to a string composition which does not have the check branch (Matches("ALTER", "VIEW", MatchAny, "SET")).
>
> I think it may worth looking at "alter materialized view"  completion tree and making "alter view" the same way.
>
> The new status of this patch is: Waiting on Author

I think this patch received real feedback and it looks like it's clear
where there's more work needed. I'll move this to the next commitfest.
If you plan to work on it this month we can always move it back.


-- 
Gregory Stark
As Commitfest Manager






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [PATCH] psql: Add tab-complete for optional view parameters
@ 2023-07-06 13:28  Daniel Gustafsson <[email protected]>
  parent: Mikhail Gribkov <[email protected]>
  1 sibling, 0 replies; 5+ messages in thread

From: Daniel Gustafsson @ 2023-07-06 13:28 UTC (permalink / raw)
  To: Christoph Heiss <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]>; Mikhail Gribkov <[email protected]>

> On 29 Jan 2023, at 11:19, Mikhail Gribkov <[email protected]> wrote:

> The new status of this patch is: Waiting on Author

This patch has been Waiting on Author since January with the thread being
stale, so I am marking this as Returned with Feedback for now.  Please feel
free to resubmit to a future CF when there is renewed interest in working on
this.

--
Daniel Gustafsson







^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2023-07-06 13:28 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 23:59 [PATCH v16 02/10] pg_stat_file and pg_ls_dir_* to use lstat().. Justin Pryzby <[email protected]>
2023-01-11 22:29 Re: [PATCH] psql: Add tab-complete for optional view parameters Thomas Munro <[email protected]>
2023-01-29 10:19 ` Re: [PATCH] psql: Add tab-complete for optional view parameters Mikhail Gribkov <[email protected]>
2023-03-20 18:40   ` Re: [PATCH] psql: Add tab-complete for optional view parameters Gregory Stark (as CFM) <[email protected]>
2023-07-06 13:28   ` Re: [PATCH] psql: Add tab-complete for optional view parameters Daniel Gustafsson <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox