Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add concat and concat_ws functions #6927

Merged
merged 9 commits into from
Mar 1, 2021

Conversation

directionless
Copy link
Member

Add NULL ignoring concat functions. These are modeled after postgres's functions.

Why

I often find myself wanting to construct simple unique keys based on columns. But, unfortunately, the usual concat operator || returns NULL. concat provides a cleaner approach to littering coalesce everywhere.

Compare:

osquery> select 'hello' || NULL || 'world';
'hello' || NULL || 'world' = 

osquery> select coalesce('hello', '') || coalesce(NULL, '') || coalesce('world', '');
coalesce('hello', '') || coalesce(NULL, '') || coalesce('world', '') = helloworld

osquery> select concat('hello', NULL, 'world');
concat('hello', NULL, 'world') = helloworld

Copy link
Member

@mike-myers-tob mike-myers-tob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to commit osquery/sql/virtual_table.cpp-alex ?

@directionless
Copy link
Member Author

osquery/sql/virtual_table.cpp-alex

Ha. No, oops.

zwass
zwass previously requested changes Feb 5, 2021
Copy link
Member

@zwass zwass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On board with the concept but some changes requested. Thank you!

docs/wiki/introduction/sql.md Show resolved Hide resolved
docs/wiki/introduction/sql.md Outdated Show resolved Hide resolved
osquery/sql/sqlite_string.cpp Outdated Show resolved Hide resolved
osquery/sql/sqlite_string.cpp Outdated Show resolved Hide resolved
@directionless directionless added this to the 4.7.0 milestone Feb 16, 2021
osquery/sql/sqlite_string.cpp Outdated Show resolved Hide resolved
osquery/sql/sqlite_string.cpp Outdated Show resolved Hide resolved
@directionless directionless requested a review from a team as a code owner February 22, 2021 01:49
@directionless directionless dismissed stale reviews from theopolis and zwass February 27, 2021 02:27

updated with feedback

@directionless
Copy link
Member Author

@zwass, @theopolis I think I got your feedback in. How's this?

@theopolis theopolis merged commit 02b91b5 into osquery:master Mar 1, 2021
@directionless directionless deleted the seph/concat branch July 5, 2021 13:28
aikuchin pushed a commit to aikuchin/osquery that referenced this pull request Jul 11, 2023
…0 to master

* commit '943935789dbfb03b55db1471ed1595e1fd4ffe23': (119 commits)
  seccomp migrations
  Add 4.7.0 CHANGELOG (osquery#6985)
  ATC fails because journal_mode pragma is blocked by sqlite authorizer (osquery#6999)
  Always use BIGINT macro for 'long long' data (osquery#6986)
  chrome_extensions: Refactor the table, add tests (osquery#6780)
  Remove extraneous lenses directory for augues on macOS (osquery#6998)
  Update the info about macOS CI (osquery#6988)
  Make Group ID columns consistent across Windows tables (osquery#6987)
  Fix mem leak regression with Windows' sids API (osquery#6984)
  Fix error in process_open_files around stoi vs stoul (osquery#6983)
  Remove hash and yara table from fuzz harnesses (osquery#6972)
  Augeas Table: Don't autoload system lenses (osquery#6980)
  Augeas Table: Fix output bug (osquery#6981)
  Add concat and concat_ws functions (osquery#6927)
  Copy JSON objects to avoid MemoryPool buildup (osquery#6957)
  Fix CODEOWNERS syntax to allow committers and TSC (osquery#6975)
  augeas: Clear aug pointer on error (osquery#6973)
  Adds support for the computer field in Windows Eventlogs (osquery#6952)
  Add Shellbags table (osquery#6949)
  Implementation of VM metadata table for Yandex.Cloud (osquery#6961)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants