Skip to content

Commit

Permalink
Fix build warning in sys_functions.sql (babelfish-for-postgresql#3030)
Browse files Browse the repository at this point in the history
In sys_functions.sql file, we have defined the sys.is_member() function
which internally calls CHARINDEX('\', ...). During build, the compiler
treats \' as an escaped quote and thus complains that there is
unterminated quote. To fix this, added a single quote as a comment.

Task: BABEL-5359
Signed-off-by: Sharu Goel <[email protected]>
  • Loading branch information
thephantomthief authored and Sharu Goel committed Oct 28, 2024
1 parent 7b3430c commit a141a20
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions contrib/babelfishpg_common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ FLAG_TO_CHECK := -DENABLE_SPATIAL_TYPES
ifeq (,$(filter $(FLAG_TO_CHECK),$(PG_CPPFLAGS)))
# The flag is not present then build the .in file not including the spatial type files
sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).in
cpp $< | sed 's/^# /-- /g' > $@
cpp -Werror $< | sed 's/^# /-- /g' > $@

sql/$(EXTENSION)--3.2.0--3.3.0.sql: sql/upgrades/babelfishpg_upgrades.in
cpp -D PREV_VERSION=3.2.0 -D CUR_VERSION=3.3.0 $< | sed 's/^# /-- /g' > $@
Expand All @@ -122,7 +122,7 @@ ifeq (,$(filter $(FLAG_TO_CHECK),$(PG_CPPFLAGS)))
else
# The flag is present build the .in file including the spatial type files
sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).in
cpp -D ENABLE_SPATIAL_TYPES=1 $< | sed 's/^# /-- /g' > $@
cpp -Werror -D ENABLE_SPATIAL_TYPES=1 $< | sed 's/^# /-- /g' > $@

sql/$(EXTENSION)--3.2.0--3.3.0.sql: sql/upgrades/babelfishpg_upgrades.in
cpp -D ENABLE_SPATIAL_TYPES=1 -D PREV_VERSION=3.2.0 -D CUR_VERSION=3.3.0 $< | sed 's/^# /-- /g' > $@
Expand Down
2 changes: 1 addition & 1 deletion contrib/babelfishpg_tsql/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ $(EXTENSION).control: $(EXTENSION).control.in
> $@

sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).in
cpp $< | sed 's/^# /-- /g' > $@
cpp -Werror $< | sed 's/^# /-- /g' > $@

sql/%.sql: sql/upgrades/%.sql
cp $< $@
Expand Down
2 changes: 1 addition & 1 deletion contrib/babelfishpg_tsql/sql/sys_functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4423,7 +4423,7 @@ CREATE OR REPLACE FUNCTION sys.is_member(IN role sys.SYSNAME)
RETURNS INT AS
$$
DECLARE
is_windows_grp boolean := (CHARINDEX('\', role) != 0);
is_windows_grp boolean := (CHARINDEX('\', role) != 0); -- ' adding quote in comment to suppress build warning
BEGIN
-- Always return 1 for 'public'
IF (role = 'public')
Expand Down

0 comments on commit a141a20

Please sign in to comment.