Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite3c5701

Browse files
authored
Merge pull requestpostgrespro#50 from postgrespro/PGPRO-9047
Fixed parsing empty string into NULL
2 parents55bc24e +8011ac5 commite3c5701

File tree

6 files changed

+19
-11
lines changed

6 files changed

+19
-11
lines changed

‎expected/jsquery.out

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ set escape_string_warning=off;
33
set standard_conforming_strings=on;
44
CREATE TABLE test_jsquery (v jsonb);
55
\copy test_jsquery from 'data/test_jsquery.data'
6+
select ''::jsquery;
7+
ERROR: bad jsquery representation
8+
LINE 1: select ''::jsquery;
9+
^
10+
DETAIL: No symbols read at the end of input
611
select 'asd.zzz = 13'::jsquery;
712
jsquery
813
------------------

‎expected/jsquery_1.out

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ set escape_string_warning=off;
33
set standard_conforming_strings=on;
44
CREATE TABLE test_jsquery (v jsonb);
55
\copy test_jsquery from 'data/test_jsquery.data'
6+
select ''::jsquery;
7+
ERROR: bad jsquery representation
8+
LINE 1: select ''::jsquery;
9+
^
10+
DETAIL: No symbols read at the end of input
611
select 'asd.zzz = 13'::jsquery;
712
jsquery
813
------------------

‎jsquery_gram.y

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ result:
258258
*result =$1;
259259
(void)yynerrs;/* suppress compiler warning*/
260260
}
261-
|/* EMPTY*/{ *result =NULL; }
261+
|/* EMPTY*/{
262+
*result =NULL;
263+
yyerror(NULL,"No symbols read"); }
262264
;
263265

264266
array:

‎jsquery_io.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,12 @@ jsquery_in(PG_FUNCTION_ARGS)
162162

163163
appendStringInfoSpaces(&buf,VARHDRSZ);
164164

165-
if (jsquery!=NULL)
166-
{
167-
flattenJsQueryParseItem(&buf,jsquery, false);
168-
169-
res= (JsQuery*)buf.data;
170-
SET_VARSIZE(res,buf.len);
165+
flattenJsQueryParseItem(&buf,jsquery, false);
171166

172-
PG_RETURN_JSQUERY(res);
173-
}
167+
res= (JsQuery*)buf.data;
168+
SET_VARSIZE(res,buf.len);
174169

175-
PG_RETURN_NULL();
170+
PG_RETURN_JSQUERY(res);
176171
}
177172

178173
staticvoid

‎jsquery_scan.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ yyerror(JsQueryParseItem **result, const char *message)
206206
(errcode(ERRCODE_SYNTAX_ERROR),
207207
errmsg("bad jsquery representation"),
208208
/* translator: %s is typically"syntax error" */
209-
errdetail("%s at end of input", message)));
209+
errdetail("%s attheend of input", message)));
210210
}
211211
else
212212
{

‎sql/jsquery.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CREATE TABLE test_jsquery (v jsonb);
77

88
\copy test_jsqueryfrom'data/test_jsquery.data'
99

10+
select''::jsquery;
1011
select'asd.zzz = 13'::jsquery;
1112
select'asd.zzz < 13'::jsquery;
1213
select'asd(zzz < 13)'::jsquery;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp