Files
threshold/internal/db/sqltest/tests/wh/upsert_user/insert.sql
T
429247f407 [COMPLIANCE] Update Copyright Headers (#6282)
* [COMPLIANCE] Update Copyright and License Headers

* chore: make gen to generate files with copyright headers

* chore: update missed copyright headers

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Justin Nguyen <justin.nguyen@hashicorp.com>
2026-01-28 11:05:07 -06:00

21 lines
646 B
PL/PgSQL

-- Copyright IBM Corp. 2020, 2025
-- SPDX-License-Identifier: BUSL-1.1
-- insert tests that the wh_upsert_user function will do an insert when
-- no existing source wh_user_dimension exists.
begin;
select plan(3);
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets');
-- ensure no existing dimensions
select is(count(*), 0::bigint) from wh_user_dimension where user_id = 'u_____wilson';
select lives_ok($$select wh_upsert_user('tok___wilson')$$);
-- upsert should insert a user_dimension
select is(count(*), 1::bigint) from wh_user_dimension where user_id = 'u_____wilson';
select * from finish();
rollback;