aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc/preproc.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/preproc/preproc.y')
-rw-r--r--src/interfaces/ecpg/preproc/preproc.y16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y
index 9a7b348f619..6f320b06d50 100644
--- a/src/interfaces/ecpg/preproc/preproc.y
+++ b/src/interfaces/ecpg/preproc/preproc.y
@@ -4032,12 +4032,24 @@ connection_target: database_name opt_server opt_port
}
| db_prefix server opt_port '/' database_name opt_options
{
- /* new style: esql:postgresql://server[:port][/dbname] */
+ /* new style: <tcp|unix>:postgresql://server[:port][/dbname] */
if (strncmp($2, "://", 3) != 0)
{
sprintf(errortext, "parse error at or near '%s'", $2);
yyerror(errortext);
}
+
+ if (strncmp($1, "unix", 4) == 0 && strncmp($2, "localhost", 9) != 0)
+ {
+ sprintf(errortext, "unix domain sockets only work on 'localhost'");
+ yyerror(errortext);
+ }
+
+ if (strncmp($1, "unix", 4) != 0 && strncmp($1, "tcp", 3) != 0)
+ {
+ sprintf(errortext, "only protocols 'tcp' and 'unix' are supported");
+ yyerror(errortext);
+ }
$$ = make4_str(make5_str(make1_str("\""), $1, $2, $3, make1_str("/")), $5, $6, make1_str("\""));
}
@@ -4061,7 +4073,7 @@ db_prefix: ident cvariable
yyerror(errortext);
}
- if (strcmp($1, "esql") != 0 && strcmp($1, "ecpg") != 0 && strcmp($1, "sql") != 0 && strcmp($1, "isql") != 0 && strcmp($1, "proc") != 0)
+ if (strcmp($1, "tcp") != 0 && strcmp($1, "unix") != 0)
{
sprintf(errortext, "Illegal connection type %s", $1);
yyerror(errortext);