schemacrawler / SchemaCrawler

Free database schema discovery and comprehension tool
http://www.schemacrawler.com/
Other
1.62k stars 200 forks source link

Grep Definition Pattern Include not matching even with .* #1294

Closed cdelaet closed 1 year ago

cdelaet commented 1 year ago

Description

This line in schemacrawler.config.properties: schemacrawler.grep.definition.pattern.include=.* should match all routine definitions (I thought), however it matches nothing. If I put the line in # comments, it matches everything.

If I add a pattern which should match (part of a Stored Procedure definition), it also doesn't match while it should match: schemacrawler.grep.definition.pattern.include=.*Versie.*

What am I doing wrong?

How to Reproduce

Using SQL Server (or an offline copy), running this command, produces the correct output:

schemacrawler.sh --server=offline --database=testinfordat.ser --info-level=maximum --command=list --schemas=TESTINFORDAT.dbo --routines=".*\"SA_NewStudent\;?[0-9]?\"" --tables=

System Information
========================================================================

generated by                              SchemaCrawler 16.20.4
generated on                              2023-10-18 15:09:55

Routines
========================================================================

TESTINFORDAT.dbo."SA_NewStudent;1"             [function, returns table]

However, if I use the same command and I uncomment the line schemacrawler.grep.definition.pattern.include=.* in the configuration file, I get this output:

System Information
========================================================================

generated by                              SchemaCrawler 16.20.4
generated on                              2023-10-18 15:09:55

Relevant log output

FINE: Including <TESTINFORDAT.dbo> since it matches /TESTINFORDAT.dbo/
Oct 19, 2023 12:57:53 PM schemacrawler.inclusionrule.RegularExpressionRule test
FINE: Including <TESTINFORDAT.dbo."SA_NewStudent;1"> since it matches /.*"SA_NewStudent\;?[0-9]?"/
Oct 19, 2023 12:57:53 PM schemacrawler.inclusionrule.RegularExpressionRule test
FINE: Excluding, since text is blank
Oct 19, 2023 12:57:53 PM schemacrawler.inclusionrule.RegularExpressionRule test
FINE: Excluding, since text is blank
Oct 19, 2023 12:57:53 PM schemacrawler.inclusionrule.RegularExpressionRule test
FINE: Excluding, since text is blank
Oct 19, 2023 12:57:53 PM schemacrawler.inclusionrule.RegularExpressionRule test
FINE: Excluding, since text is blank
Oct 19, 2023 12:57:53 PM schemacrawler.inclusionrule.RegularExpressionRule test
FINE: Excluding, since text is blank
Oct 19, 2023 12:57:53 PM schemacrawler.inclusionrule.RegularExpressionRule test
FINE: Excluding, since text is blank
Oct 19, 2023 12:57:53 PM schemacrawler.inclusionrule.RegularExpressionRule test
FINE: Excluding, since text is blank
Oct 19, 2023 12:57:53 PM schemacrawler.inclusionrule.RegularExpressionRule test
FINE: Excluding, since text is blank
Oct 19, 2023 12:57:53 PM schemacrawler.inclusionrule.RegularExpressionRule test
FINE: Excluding, since text is blank
Oct 19, 2023 12:57:53 PM schemacrawler.inclusionrule.RegularExpressionRule test
FINE: Excluding, since text is blank
Oct 19, 2023 12:57:53 PM schemacrawler.inclusionrule.RegularExpressionRule test
FINE: Excluding, since text is blank
Oct 19, 2023 12:57:53 PM schemacrawler.inclusionrule.RegularExpressionRule test
FINE: Excluding </* Versie: xxx xx xxx xxxx - xxxxx */
/* Laatst gewijzigd door xxxxxx */
CREATE PROCEDURE [dbo].[SA_NewStudent]
@parGebruiker int,
/* snip */ 
@outPersoonID int OUTPUT
AS
BEGIN

BEGIN TRY

DECLARE @IsTopTransaction int

/* snip*/
END CATCH

END> since it does not match /.*/
Oct 19, 2023 12:57:53 PM schemacrawler.filter.RoutineGrepFilter test
FINE: Excluding routine <TESTINFORDAT.dbo."SA_NewStudent;1">

SchemaCrawler Version

16.20.4

Java Version

Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 19.0.2+7-44

Operating System and Version

Mac OS X 14.0

Relational Database System and Version

SQL Server 2019

JDBC Driver and Version

com.microsoft.sqlserver.jdbc.SQLServerDriver 12.2

cdelaet commented 1 year ago

In addition, but unrelated to this issue I think, it's strange that schemacrawler lists all Stored Procedures as "function" (see output in How to Reproduce above).

sualeh commented 1 year ago

@cdelaet Would you be able to give me "testinfordat.ser", or scripts to create the database? If you are not comfortable posting here, email them to sualeh@hotmail.com.

sualeh commented 1 year ago

In addition, but unrelated to this issue I think, it's strange that schemacrawler lists all Stored Procedures as "function" (see output in How to Reproduce above).

Let me take a look at that. It may be how the driver is reporting something. Please file another bug for that, to keep the issues separate. Thanks.

cdelaet commented 1 year ago

I did as you requested, Sualeh. Thank you for looking into this.

cdelaet commented 1 year ago

Let me know if there is anything else I can do to help with this issue. I would like to use Schemacrawler to help document our (huge) database, but this limits the usability for me.

sualeh commented 1 year ago

@cdelaet My laptop is down. 😢 Waiting for it to get repaired. Please could you resend the .ser file - the link expired. Thanks.

sualeh commented 1 year ago

@cdelaet Please try SchemaCrawler v16.20.5, and let me know if it works for you. Thanks.

cdelaet commented 11 months ago

regex searches in Stored Procedures work perfectly now. Thank you, Sualeh!