($INBOX_DIR/description missing)  
help / color / mirror / Atom feed
[PATCH 4/9] Remove the last vestiges of Exporter from PostgresNode
6+ messages / 3 participants
[nested] [flat]

* [PATCH 4/9] Remove the last vestiges of Exporter from PostgresNode
@ 2021-06-01 17:49  Andrew Dunstan <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Andrew Dunstan @ 2021-06-01 17:49 UTC (permalink / raw)

Clients wanting to call get_free_port now need to do so via a qualified
name: PostgresNode::get_free_port().
---
 src/bin/pg_ctl/t/001_start_stop.pl |  2 +-
 src/test/kerberos/t/001_auth.pl    |  2 +-
 src/test/ldap/t/001_auth.pl        |  4 ++--
 src/test/perl/PostgresNode.pm      | 14 ++++++--------
 4 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl
index 4bfc23b93d..1d8d6bbb70 100644
--- a/src/bin/pg_ctl/t/001_start_stop.pl
+++ b/src/bin/pg_ctl/t/001_start_stop.pl
@@ -25,7 +25,7 @@ command_ok([ 'pg_ctl', 'initdb', '-D', "$tempdir/data", '-o', '-N' ],
 	'pg_ctl initdb');
 command_ok([ $ENV{PG_REGRESS}, '--config-auth', "$tempdir/data" ],
 	'configure authentication');
-my $node_port = get_free_port();
+my $node_port = PostgresNode::get_free_port();
 open my $conf, '>>', "$tempdir/data/postgresql.conf";
 print $conf "fsync = off\n";
 print $conf "port = $node_port\n";
diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl
index d6191498f0..34562045cb 100644
--- a/src/test/kerberos/t/001_auth.pl
+++ b/src/test/kerberos/t/001_auth.pl
@@ -74,7 +74,7 @@ my $kdc_conf    = "${TestLib::tmp_check}/kdc.conf";
 my $krb5_cache  = "${TestLib::tmp_check}/krb5cc";
 my $krb5_log    = "${TestLib::log_path}/krb5libs.log";
 my $kdc_log     = "${TestLib::log_path}/krb5kdc.log";
-my $kdc_port    = get_free_port();
+my $kdc_port    = PostgresNode::get_free_port();
 my $kdc_datadir = "${TestLib::tmp_check}/krb5kdc";
 my $kdc_pidfile = "${TestLib::tmp_check}/krb5kdc.pid";
 my $keytab      = "${TestLib::tmp_check}/krb5.keytab";
diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl
index 553041baa2..1d1282f8dc 100644
--- a/src/test/ldap/t/001_auth.pl
+++ b/src/test/ldap/t/001_auth.pl
@@ -58,8 +58,8 @@ my $slapd_pidfile = "${TestLib::tmp_check}/slapd.pid";
 my $slapd_logfile = "${TestLib::log_path}/slapd.log";
 my $ldap_conf     = "${TestLib::tmp_check}/ldap.conf";
 my $ldap_server   = 'localhost';
-my $ldap_port     = get_free_port();
-my $ldaps_port    = get_free_port();
+my $ldap_port     = PostgresNode::get_free_port();
+my $ldaps_port    = PostgresNode::get_free_port();
 my $ldap_url      = "ldap://$ldap_server:$ldap_port";
 my $ldaps_url     = "ldaps://$ldap_server:$ldaps_port";
 my $ldap_basedn   = 'dc=example,dc=net';
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index 2a889065ea..7ed52c83bb 100644
--- a/src/test/perl/PostgresNode.pm
+++ b/src/test/perl/PostgresNode.pm
@@ -69,7 +69,7 @@ PostgresNode - class representing PostgreSQL server instance
   $node->stop('fast');
 
   # Find a free, unprivileged TCP port to bind some other service to
-  my $port = get_free_port();
+  my $port = PostgresNode::get_free_port();
 
 =head1 DESCRIPTION
 
@@ -93,7 +93,6 @@ use warnings;
 use Carp;
 use Config;
 use Cwd;
-use Exporter 'import';
 use Fcntl qw(:mode);
 use File::Basename;
 use File::Path qw(rmtree);
@@ -109,10 +108,6 @@ use TestLib ();
 use Time::HiRes qw(usleep);
 use Scalar::Util qw(blessed);
 
-our @EXPORT = qw(
-  get_free_port
-);
-
 our ($use_tcp, $test_localhost, $test_pghost, $last_host_assigned,
 	$last_port_assigned, @all_nodes, $died);
 
@@ -1379,8 +1374,8 @@ sub installed_command
 =item get_free_port()
 
 Locate an unprivileged (high) TCP port that's not currently bound to
-anything.  This is used by new(), and is also exported for use
-by test cases that need to start other, non-Postgres servers.
+anything.  This is used by C<new()>, and also by some test cases that need to
+start other, non-Postgres servers.
 
 Ports assigned to existing PostgresNode objects are automatically
 excluded, even if those servers are not currently running.
@@ -1388,6 +1383,9 @@ excluded, even if those servers are not currently running.
 XXX A port available now may become unavailable by the time we start
 the desired service.
 
+Note: this is not an instance method. As it's not exported it should be
+called from outside the module as C<PostgresNode::get_free_port()>.
+
 =cut
 
 sub get_free_port
-- 
2.25.4


--------------4E4CE6CCDFE521456659ABE6
Content-Type: text/x-patch; charset=UTF-8;
 name="0005-Add-a-method-to-PostgresVersion.pm-to-produce-the-ma.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0005-Add-a-method-to-PostgresVersion.pm-to-produce-the-ma.pa";
 filename*1="tch"



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

* [PATCH 4/9] Remove the last vestiges of Exporter from PostgresNode
@ 2021-06-01 17:49  Andrew Dunstan <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Andrew Dunstan @ 2021-06-01 17:49 UTC (permalink / raw)

Clients wanting to call get_free_port now need to do so via a qualified
name: PostgresNode::get_free_port().
---
 src/bin/pg_ctl/t/001_start_stop.pl |  2 +-
 src/test/kerberos/t/001_auth.pl    |  2 +-
 src/test/ldap/t/001_auth.pl        |  4 ++--
 src/test/perl/PostgresNode.pm      | 14 ++++++--------
 4 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl
index 4bfc23b93d..1d8d6bbb70 100644
--- a/src/bin/pg_ctl/t/001_start_stop.pl
+++ b/src/bin/pg_ctl/t/001_start_stop.pl
@@ -25,7 +25,7 @@ command_ok([ 'pg_ctl', 'initdb', '-D', "$tempdir/data", '-o', '-N' ],
 	'pg_ctl initdb');
 command_ok([ $ENV{PG_REGRESS}, '--config-auth', "$tempdir/data" ],
 	'configure authentication');
-my $node_port = get_free_port();
+my $node_port = PostgresNode::get_free_port();
 open my $conf, '>>', "$tempdir/data/postgresql.conf";
 print $conf "fsync = off\n";
 print $conf "port = $node_port\n";
diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl
index d6191498f0..34562045cb 100644
--- a/src/test/kerberos/t/001_auth.pl
+++ b/src/test/kerberos/t/001_auth.pl
@@ -74,7 +74,7 @@ my $kdc_conf    = "${TestLib::tmp_check}/kdc.conf";
 my $krb5_cache  = "${TestLib::tmp_check}/krb5cc";
 my $krb5_log    = "${TestLib::log_path}/krb5libs.log";
 my $kdc_log     = "${TestLib::log_path}/krb5kdc.log";
-my $kdc_port    = get_free_port();
+my $kdc_port    = PostgresNode::get_free_port();
 my $kdc_datadir = "${TestLib::tmp_check}/krb5kdc";
 my $kdc_pidfile = "${TestLib::tmp_check}/krb5kdc.pid";
 my $keytab      = "${TestLib::tmp_check}/krb5.keytab";
diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl
index 553041baa2..1d1282f8dc 100644
--- a/src/test/ldap/t/001_auth.pl
+++ b/src/test/ldap/t/001_auth.pl
@@ -58,8 +58,8 @@ my $slapd_pidfile = "${TestLib::tmp_check}/slapd.pid";
 my $slapd_logfile = "${TestLib::log_path}/slapd.log";
 my $ldap_conf     = "${TestLib::tmp_check}/ldap.conf";
 my $ldap_server   = 'localhost';
-my $ldap_port     = get_free_port();
-my $ldaps_port    = get_free_port();
+my $ldap_port     = PostgresNode::get_free_port();
+my $ldaps_port    = PostgresNode::get_free_port();
 my $ldap_url      = "ldap://$ldap_server:$ldap_port";
 my $ldaps_url     = "ldaps://$ldap_server:$ldaps_port";
 my $ldap_basedn   = 'dc=example,dc=net';
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index 2a889065ea..7ed52c83bb 100644
--- a/src/test/perl/PostgresNode.pm
+++ b/src/test/perl/PostgresNode.pm
@@ -69,7 +69,7 @@ PostgresNode - class representing PostgreSQL server instance
   $node->stop('fast');
 
   # Find a free, unprivileged TCP port to bind some other service to
-  my $port = get_free_port();
+  my $port = PostgresNode::get_free_port();
 
 =head1 DESCRIPTION
 
@@ -93,7 +93,6 @@ use warnings;
 use Carp;
 use Config;
 use Cwd;
-use Exporter 'import';
 use Fcntl qw(:mode);
 use File::Basename;
 use File::Path qw(rmtree);
@@ -109,10 +108,6 @@ use TestLib ();
 use Time::HiRes qw(usleep);
 use Scalar::Util qw(blessed);
 
-our @EXPORT = qw(
-  get_free_port
-);
-
 our ($use_tcp, $test_localhost, $test_pghost, $last_host_assigned,
 	$last_port_assigned, @all_nodes, $died);
 
@@ -1379,8 +1374,8 @@ sub installed_command
 =item get_free_port()
 
 Locate an unprivileged (high) TCP port that's not currently bound to
-anything.  This is used by new(), and is also exported for use
-by test cases that need to start other, non-Postgres servers.
+anything.  This is used by C<new()>, and also by some test cases that need to
+start other, non-Postgres servers.
 
 Ports assigned to existing PostgresNode objects are automatically
 excluded, even if those servers are not currently running.
@@ -1388,6 +1383,9 @@ excluded, even if those servers are not currently running.
 XXX A port available now may become unavailable by the time we start
 the desired service.
 
+Note: this is not an instance method. As it's not exported it should be
+called from outside the module as C<PostgresNode::get_free_port()>.
+
 =cut
 
 sub get_free_port
-- 
2.25.4


--------------2D62665F86298A3CD7493562
Content-Type: text/x-patch; charset=UTF-8;
 name="0005-Add-a-method-to-PostgresVersion.pm-to-produce-the-ma.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0005-Add-a-method-to-PostgresVersion.pm-to-produce-the-ma.pa";
 filename*1="tch"



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

* [PATCH 4/6] Remove the last vestiges of Exporter from PostgresNode
@ 2021-07-18 15:41  Andrew Dunstan <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Andrew Dunstan @ 2021-07-18 15:41 UTC (permalink / raw)

Clients wanting to call get_free_port now need to do so via a qualified
name: PostgresNode::get_free_port().
---
 src/bin/pg_ctl/t/001_start_stop.pl |  2 +-
 src/test/kerberos/t/001_auth.pl    |  2 +-
 src/test/ldap/t/001_auth.pl        |  4 ++--
 src/test/perl/PostgresNode.pm      | 14 ++++++--------
 4 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl
index 4bfc23b93d..1d8d6bbb70 100644
--- a/src/bin/pg_ctl/t/001_start_stop.pl
+++ b/src/bin/pg_ctl/t/001_start_stop.pl
@@ -25,7 +25,7 @@ command_ok([ 'pg_ctl', 'initdb', '-D', "$tempdir/data", '-o', '-N' ],
 	'pg_ctl initdb');
 command_ok([ $ENV{PG_REGRESS}, '--config-auth', "$tempdir/data" ],
 	'configure authentication');
-my $node_port = get_free_port();
+my $node_port = PostgresNode::get_free_port();
 open my $conf, '>>', "$tempdir/data/postgresql.conf";
 print $conf "fsync = off\n";
 print $conf "port = $node_port\n";
diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl
index d6191498f0..34562045cb 100644
--- a/src/test/kerberos/t/001_auth.pl
+++ b/src/test/kerberos/t/001_auth.pl
@@ -74,7 +74,7 @@ my $kdc_conf    = "${TestLib::tmp_check}/kdc.conf";
 my $krb5_cache  = "${TestLib::tmp_check}/krb5cc";
 my $krb5_log    = "${TestLib::log_path}/krb5libs.log";
 my $kdc_log     = "${TestLib::log_path}/krb5kdc.log";
-my $kdc_port    = get_free_port();
+my $kdc_port    = PostgresNode::get_free_port();
 my $kdc_datadir = "${TestLib::tmp_check}/krb5kdc";
 my $kdc_pidfile = "${TestLib::tmp_check}/krb5kdc.pid";
 my $keytab      = "${TestLib::tmp_check}/krb5.keytab";
diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl
index 553041baa2..1d1282f8dc 100644
--- a/src/test/ldap/t/001_auth.pl
+++ b/src/test/ldap/t/001_auth.pl
@@ -58,8 +58,8 @@ my $slapd_pidfile = "${TestLib::tmp_check}/slapd.pid";
 my $slapd_logfile = "${TestLib::log_path}/slapd.log";
 my $ldap_conf     = "${TestLib::tmp_check}/ldap.conf";
 my $ldap_server   = 'localhost';
-my $ldap_port     = get_free_port();
-my $ldaps_port    = get_free_port();
+my $ldap_port     = PostgresNode::get_free_port();
+my $ldaps_port    = PostgresNode::get_free_port();
 my $ldap_url      = "ldap://$ldap_server:$ldap_port";
 my $ldaps_url     = "ldaps://$ldap_server:$ldaps_port";
 my $ldap_basedn   = 'dc=example,dc=net';
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index 8889d26ff5..08519129d8 100644
--- a/src/test/perl/PostgresNode.pm
+++ b/src/test/perl/PostgresNode.pm
@@ -69,7 +69,7 @@ PostgresNode - class representing PostgreSQL server instance
   $node->stop('fast');
 
   # Find a free, unprivileged TCP port to bind some other service to
-  my $port = get_free_port();
+  my $port = PostgresNode::get_free_port();
 
 =head1 DESCRIPTION
 
@@ -93,7 +93,6 @@ use warnings;
 use Carp;
 use Config;
 use Cwd;
-use Exporter 'import';
 use Fcntl qw(:mode);
 use File::Basename;
 use File::Path qw(rmtree);
@@ -109,10 +108,6 @@ use TestLib ();
 use Time::HiRes qw(usleep);
 use Scalar::Util qw(blessed);
 
-our @EXPORT = qw(
-  get_free_port
-);
-
 our ($use_tcp, $test_localhost, $test_pghost, $last_host_assigned,
 	$last_port_assigned, @all_nodes, $died);
 
@@ -1381,8 +1376,8 @@ sub installed_command
 =item get_free_port()
 
 Locate an unprivileged (high) TCP port that's not currently bound to
-anything.  This is used by new(), and is also exported for use
-by test cases that need to start other, non-Postgres servers.
+anything.  This is used by C<new()>, and also by some test cases that need to
+start other, non-Postgres servers.
 
 Ports assigned to existing PostgresNode objects are automatically
 excluded, even if those servers are not currently running.
@@ -1390,6 +1385,9 @@ excluded, even if those servers are not currently running.
 XXX A port available now may become unavailable by the time we start
 the desired service.
 
+Note: this is not an instance method. As it's not exported it should be
+called from outside the module as C<PostgresNode::get_free_port()>.
+
 =cut
 
 sub get_free_port
-- 
2.25.4


--------------401D4E40781FC9847DEE78ED
Content-Type: text/x-patch; charset=UTF-8;
 name="0005-Add-PostgresVersion.pm-method-to-emit-the-major-vers.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0005-Add-PostgresVersion.pm-method-to-emit-the-major-vers.pa";
 filename*1="tch"



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

* [PATCH 4/6] Remove the last vestiges of Exporter from PostgresNode
@ 2021-07-18 15:41  Andrew Dunstan <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Andrew Dunstan @ 2021-07-18 15:41 UTC (permalink / raw)

Clients wanting to call get_free_port now need to do so via a qualified
name: PostgresNode::get_free_port().
---
 src/bin/pg_ctl/t/001_start_stop.pl |  2 +-
 src/test/kerberos/t/001_auth.pl    |  2 +-
 src/test/ldap/t/001_auth.pl        |  4 ++--
 src/test/perl/PostgresNode.pm      | 14 ++++++--------
 4 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl
index 4bfc23b93d..1d8d6bbb70 100644
--- a/src/bin/pg_ctl/t/001_start_stop.pl
+++ b/src/bin/pg_ctl/t/001_start_stop.pl
@@ -25,7 +25,7 @@ command_ok([ 'pg_ctl', 'initdb', '-D', "$tempdir/data", '-o', '-N' ],
 	'pg_ctl initdb');
 command_ok([ $ENV{PG_REGRESS}, '--config-auth', "$tempdir/data" ],
 	'configure authentication');
-my $node_port = get_free_port();
+my $node_port = PostgresNode::get_free_port();
 open my $conf, '>>', "$tempdir/data/postgresql.conf";
 print $conf "fsync = off\n";
 print $conf "port = $node_port\n";
diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl
index d6191498f0..34562045cb 100644
--- a/src/test/kerberos/t/001_auth.pl
+++ b/src/test/kerberos/t/001_auth.pl
@@ -74,7 +74,7 @@ my $kdc_conf    = "${TestLib::tmp_check}/kdc.conf";
 my $krb5_cache  = "${TestLib::tmp_check}/krb5cc";
 my $krb5_log    = "${TestLib::log_path}/krb5libs.log";
 my $kdc_log     = "${TestLib::log_path}/krb5kdc.log";
-my $kdc_port    = get_free_port();
+my $kdc_port    = PostgresNode::get_free_port();
 my $kdc_datadir = "${TestLib::tmp_check}/krb5kdc";
 my $kdc_pidfile = "${TestLib::tmp_check}/krb5kdc.pid";
 my $keytab      = "${TestLib::tmp_check}/krb5.keytab";
diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl
index 553041baa2..1d1282f8dc 100644
--- a/src/test/ldap/t/001_auth.pl
+++ b/src/test/ldap/t/001_auth.pl
@@ -58,8 +58,8 @@ my $slapd_pidfile = "${TestLib::tmp_check}/slapd.pid";
 my $slapd_logfile = "${TestLib::log_path}/slapd.log";
 my $ldap_conf     = "${TestLib::tmp_check}/ldap.conf";
 my $ldap_server   = 'localhost';
-my $ldap_port     = get_free_port();
-my $ldaps_port    = get_free_port();
+my $ldap_port     = PostgresNode::get_free_port();
+my $ldaps_port    = PostgresNode::get_free_port();
 my $ldap_url      = "ldap://$ldap_server:$ldap_port";
 my $ldaps_url     = "ldaps://$ldap_server:$ldaps_port";
 my $ldap_basedn   = 'dc=example,dc=net';
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index 45c69a61ba..5cfcbcf810 100644
--- a/src/test/perl/PostgresNode.pm
+++ b/src/test/perl/PostgresNode.pm
@@ -69,7 +69,7 @@ PostgresNode - class representing PostgreSQL server instance
   $node->stop('fast');
 
   # Find a free, unprivileged TCP port to bind some other service to
-  my $port = get_free_port();
+  my $port = PostgresNode::get_free_port();
 
 =head1 DESCRIPTION
 
@@ -93,7 +93,6 @@ use warnings;
 use Carp;
 use Config;
 use Cwd;
-use Exporter 'import';
 use Fcntl qw(:mode);
 use File::Basename;
 use File::Path qw(rmtree);
@@ -109,10 +108,6 @@ use TestLib ();
 use Time::HiRes qw(usleep);
 use Scalar::Util qw(blessed);
 
-our @EXPORT = qw(
-  get_free_port
-);
-
 our ($use_tcp, $test_localhost, $test_pghost, $last_host_assigned,
 	$last_port_assigned, @all_nodes, $died);
 
@@ -1381,8 +1376,8 @@ sub installed_command
 =item get_free_port()
 
 Locate an unprivileged (high) TCP port that's not currently bound to
-anything.  This is used by new(), and is also exported for use
-by test cases that need to start other, non-Postgres servers.
+anything.  This is used by C<new()>, and also by some test cases that need to
+start other, non-Postgres servers.
 
 Ports assigned to existing PostgresNode objects are automatically
 excluded, even if those servers are not currently running.
@@ -1390,6 +1385,9 @@ excluded, even if those servers are not currently running.
 XXX A port available now may become unavailable by the time we start
 the desired service.
 
+Note: this is not an instance method. As it's not exported it should be
+called from outside the module as C<PostgresNode::get_free_port()>.
+
 =cut
 
 sub get_free_port
-- 
2.25.4


--------------19BF9C33B652121805E4472D
Content-Type: text/x-patch; charset=UTF-8;
 name="0005-Add-PostgresVersion.pm-method-to-emit-the-major-vers.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0005-Add-PostgresVersion.pm-method-to-emit-the-major-vers.pa";
 filename*1="tch"



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

* Re: Q: Escapes in jsonpath Idents
@ 2024-04-24 09:51  Peter Eisentraut <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Peter Eisentraut @ 2024-04-24 09:51 UTC (permalink / raw)
  To: Erik Wienhold <[email protected]>; David E. Wheeler <[email protected]>; +Cc: pgsql-hackers

On 18.03.24 01:09, Erik Wienhold wrote:
>>> The error message 'syntax error at or near "$oo" of jsonpath input' for
>>> the second case ($.f$oo), however, looks as if the scanner identifies
>>> '$oo' as a variable instead of contiuing the scan of identifier (f$oo)
>>> for the member accessor.  Looks like a bug to me because a variable
>>> doesn't even make sense in that place.
>> Right. Maybe the docs should be updated to say that a literal dollar
>> sign isn’t supported in identifiers, unlike in JavaScript, except
>> through escapes like this:
> Unfortunately, I don't have access to that part of the SQL spec.  So I
> don't know how the jsonpath grammar is specified.

The SQL spec says that <JSON path identifier> corresponds to Identifier 
in ECMAScript.

But it also says,

     A <JSON path identifier> is classified as follows.

     Case:

     a) A <JSON path identifier> that is a <dollar sign> is a <JSON path
        context variable>.

     b) A <JSON path identifier> that begins with <dollar sign> is a
        <JSON path named variable>.

     c) Otherwise, a <JSON path identifier> is a <JSON path key name>.

Does this help?  I wasn't following all the discussion to see if there 
is anything wrong with the implementation.







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

* Re: Q: Escapes in jsonpath Idents
@ 2024-04-24 11:52  David E. Wheeler <[email protected]>
  parent: Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: David E. Wheeler @ 2024-04-24 11:52 UTC (permalink / raw)
  To: Peter Eisentraut <[email protected]>; +Cc: Erik Wienhold <[email protected]>; pgsql-hackers

On Apr 24, 2024, at 05:51, Peter Eisentraut <[email protected]> wrote:

>    A <JSON path identifier> is classified as follows.
> 
>    Case:
> 
>    a) A <JSON path identifier> that is a <dollar sign> is a <JSON path
>       context variable>.
> 
>    b) A <JSON path identifier> that begins with <dollar sign> is a
>       <JSON path named variable>.
> 
>    c) Otherwise, a <JSON path identifier> is a <JSON path key name>.
> 
> Does this help?  I wasn't following all the discussion to see if there is anything wrong with the implementation.

Yes, it does, as it ties the special meaning of the dollar sign to the *beginning* of an expression. So it makes sense that this would be an error:

david=# select '$.$foo'::jsonpath;
ERROR: syntax error at or near "$foo" of jsonpath input
LINE 1: select '$.$foo'::jsonpath;
               ^

But I’m less sure when a dollar sign is used in the *middle* (or end) of a json path identifier:

david=# select '$.xx$foo'::jsonpath;
ERROR:  syntax error at or near "$foo" of jsonpath input
LINE 1: select '$.xx$foo'::jsonpath;
               ^

Perhaps that should be valid?

Best,

David







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


end of thread, other threads:[~2024-04-24 11:52 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01 17:49 [PATCH 4/9] Remove the last vestiges of Exporter from PostgresNode Andrew Dunstan <[email protected]>
2021-06-01 17:49 [PATCH 4/9] Remove the last vestiges of Exporter from PostgresNode Andrew Dunstan <[email protected]>
2021-07-18 15:41 [PATCH 4/6] Remove the last vestiges of Exporter from PostgresNode Andrew Dunstan <[email protected]>
2021-07-18 15:41 [PATCH 4/6] Remove the last vestiges of Exporter from PostgresNode Andrew Dunstan <[email protected]>
2024-04-24 09:51 Re: Q: Escapes in jsonpath Idents Peter Eisentraut <[email protected]>
2024-04-24 11:52 ` Re: Q: Escapes in jsonpath Idents David E. Wheeler <[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