The following issues were found
tsl/src/nodes/data_node_dispatch.c
2 issues
Line: 640
Column: 31
CWE codes:
190
Suggestion:
If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)
if (HAS_RETURNING(sds))
break;
ss->num_tuples_inserted = atoi(PQcmdTuples(res));
async_response_result_close(rsp);
Assert(sds->stmt.do_nothing || (ss->num_tuples_inserted == ss->num_tuples_sent));
report_error = false;
break;
default:
Reported by FlawFinder.
Line: 1196
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
Path *subpath = ts_chunk_dispatch_path_create(root, mtpath, hypertable_rti, subplan_index);
/* Copy costs, etc. from the subpath */
memcpy(&sdpath->cpath.path, subpath, sizeof(Path));
sdpath->cpath.path.type = T_CustomPath;
sdpath->cpath.path.pathtype = T_CustomScan;
sdpath->cpath.custom_paths = list_make1(subpath);
sdpath->cpath.methods = &data_node_dispatch_path_methods;
Reported by FlawFinder.
tsl/test/sql/continuous_aggs_tableam.sql
2 issues
Line: 5
Column: 1
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\c :TEST_DBNAME :ROLE_SUPERUSER
CREATE ACCESS METHOD heap2 TYPE TABLE HANDLER heap_tableam_handler;
SET ROLE :ROLE_DEFAULT_PERM_USER;
CREATE VIEW cagg_info AS
Reported by SQLint.
Line: 28
Column: 1
SELECT hypertable_id AS whatever_nid
FROM create_hypertable('whatever', 'time', chunk_time_interval => 10)
\gset
CREATE OR REPLACE FUNCTION integer_now_test() RETURNS bigint
LANGUAGE SQL STABLE AS $$
SELECT coalesce(max(time), bigint '0') FROM whatever
$$;
Reported by SQLint.
tsl/test/sql/include/transparent_decompression_systemcolumns.sql
2 issues
Line: 5
Column: 1
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set TEST_TABLE 'metrics'
-- test system columns
-- all system columns except for tableoid should error
\set ON_ERROR_STOP 0
SELECT xmin FROM :TEST_TABLE ORDER BY time;
Reported by SQLint.
Line: 20
Column: 1
SELECT tableoid, xmin FROM :TEST_TABLE ORDER BY time;
SELECT FROM :TEST_TABLE ORDER BY cmin::text;
SELECT FROM :TEST_TABLE WHERE cmin IS NOT NULL;
\set ON_ERROR_STOP 1
-- test tableoid in different parts of query
SELECT pg_typeof(tableoid) FROM :TEST_TABLE ORDER BY time LIMIT 1;
SELECT FROM :TEST_TABLE ORDER BY tableoid LIMIT 1;
SELECT FROM :TEST_TABLE WHERE tableoid::int > 0 LIMIT 1;
Reported by SQLint.
test/sql/updates/post.compression.sql
2 issues
Line: 22
Column: 1
SELECT * FROM compress ORDER BY time DESC, small_cardinality;
\x on
WITH hypertables AS (
SELECT ht.id hypertable_id,
ht.schema_name,
ht.table_name,
ht.compressed_hypertable_id
Reported by SQLint.
Line: 47
Column: 1
(SELECT relacl FROM pg_class WHERE oid = compressed_chunk_name::regclass) AS compressed_chunk_acl
FROM table_summary
ORDER BY hypertable_name, compressed_hypertable_name, compressed_chunk_name;
\x off
Reported by SQLint.
tsl/test/shared/sql/constraint_exclusion_prepared.sql
2 issues
Line: 23
Column: 1
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 13 THEN set_config('enable_incremental_sort','off',false) ELSE 'off' END;
set max_parallel_workers_per_gather to 0;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
\set TEST_TABLE 'metrics_space'
\ir :TEST_QUERY_NAME
\set TEST_TABLE 'metrics_compressed'
\ir :TEST_QUERY_NAME
Reported by SQLint.
Line: 41
Column: 1
SET client_min_messages TO error;
-- run queries on compressed hypertable and store result
\set TEST_TABLE 'metrics'
\o :TEST_RESULTS_UNCOMPRESSED
\ir :TEST_QUERY_NAME
\set TEST_TABLE 'metrics_compressed'
\o :TEST_RESULTS_COMPRESSED
\ir :TEST_QUERY_NAME
Reported by SQLint.
src/compression_with_clause.c
2 issues
Line: 83
Column: 6
CWE codes:
126
List *collist = NIL;
RawStmt *raw;
if (strlen(inpstr) == 0)
return NIL;
initStringInfo(&buf);
/* parse the segment by list exactly how you would a group by */
Reported by FlawFinder.
Line: 168
Column: 6
CWE codes:
126
List *collist = NIL;
RawStmt *raw;
if (strlen(inpstr) == 0)
return NIL;
initStringInfo(&buf);
/* parse the segment by list exactly how you would a order by by */
Reported by FlawFinder.
test/sql/updates/setup.v2.sql
2 issues
Line: 5
Column: 1
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
\ir setup.catalog.sql
\ir setup.bigint.sql
\ir setup.constraints.sql
\ir setup.insert_bigint.v2.sql
\ir setup.timestamp.sql
Reported by SQLint.
Line: 17
Column: 1
"time" WITH =, device_id WITH =
) WHERE (value > 0);
\ir setup.insert_timestamp.sql
\ir setup.drop_meta.sql
Reported by SQLint.
tsl/test/shared/sql/dist_distinct.sql
2 issues
Line: 5
Column: 1
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set TEST_BASE_NAME dist_distinct
-- Run
SELECT format('include/%s_run.sql', :'TEST_BASE_NAME') AS "TEST_QUERY_NAME",
format('%s/shared/results/%s_results_reference.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_REFERENCE",
format('%s/shared/results/%s_results_distributed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_DIST"
\gset
Reported by SQLint.
Line: 31
Column: 1
SET client_min_messages TO error;
-- run queries on single node hypertable and store reference result
\set TABLE_NAME 'metrics'
\o :TEST_RESULTS_REFERENCE
\ir :TEST_QUERY_NAME
-- run queries on multinode hypertable and store result
\set TABLE_NAME 'metrics_dist'
Reported by SQLint.
test/sql/updates/setup.drop_meta.sql
2 issues
Line: 6
Column: 1
-- LICENSE-APACHE for a copy of the license.
-- DROP some chunks to test metadata cleanup
\if :WITH_CHUNK
DROP TABLE _timescaledb_internal._hyper_1_2_chunk;
DROP TABLE _timescaledb_internal._hyper_1_3_chunk;
\endif
Reported by SQLint.
Line: 9
Column: 1
\if :WITH_CHUNK
DROP TABLE _timescaledb_internal._hyper_1_2_chunk;
DROP TABLE _timescaledb_internal._hyper_1_3_chunk;
\endif
Reported by SQLint.
tsl/test/shared/sql/dist_insert.sql
2 issues
Line: 29
Column: 1
SET statement_timeout TO '100ms';
\set ON_ERROR_STOP 0
INSERT INTO dist_insert
SELECT
'2000-01-01'::TIMESTAMPTZ + format('%s min', i * 10)::INTERVAL,
(i / 100)::TEXT,
random()
Reported by SQLint.
Line: 38
Column: 1
FROM
generate_series(1, 30000) AS sub(i);
\set ON_ERROR_STOP 1
RESET statement_timeout;
DROP TABLE dist_insert;
Reported by SQLint.