sql and regexp

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

sql and regexp

merituuli
Hello,

in many circumstances postfix only needs to know, that a LHS is permitted, the RHS is a dummy text, others have clear actions on the RHS.

To implement such in SQL is no problem. As far as I understood the „type:map“-scheme of lookup tables, the “type”-entry represents the mode of interpretation of the LHS-entries. So, behind the regexp-type an regexp-maschine acts, same with pcre. Hash and betree are only db-formats.

There is no problem to map hash-entries to sql-maps. But I have not found any understanding how to map an regexp or pcre map into sql, because SQL seems to me to be only an storage format. So the “type:map”-scheme seems to mix storage an parsing.

Is this true? I have not found any answer in the Net so far. I want to bring all maps into an graphical SQL-Query-Interface, specially to join maps with same LHS- and different RHS-entries into one sql-table.

Here an example:

Regexp-table #1
/^(.*)(example.com)/                       do_greylisting

Regexp-table #2
/^(.*)(example.com)/                       FILTER amavis:[127.0.0.1]:10011


I want to join them into one table. Combining SQL with regexp-parsing seems to be not implemented.


Regards,

Uwe Schneider.
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
Reply | Threaded
Open this post in threaded view
|

Re: sql and regexp

Wietse Venema
> Here an example:
>
> Regexp-table #1
> /^(.*)(example.com)/                       do_greylisting
>
> Regexp-table #2
> /^(.*)(example.com)/                       FILTER amavis:[127.0.0.1]:10011
>
>
> I want to join them into one table. Combining SQL with regexp-parsing
> seems to be not implemented.

1) The pgsql and mysql map types implement SQL queries.

2) The ldap map type implements LDAP queres.

3) The regexp and pcre map types implement regular expressions.

There currently is no design that would allow a map type of X to
query a map type of Y, other than special-case hacks that would
degenerate into an order N**2 mess (where N is the number of map
types).

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: sql and regexp

mouss-2
In reply to this post by merituuli
[hidden email] wrote:

> Hello,
>
> in many circumstances postfix only needs to know, that a LHS is permitted, the RHS is a dummy text, others have clear actions on the RHS.
>
> To implement such in SQL is no problem. As far as I understood the „type:map“-scheme of lookup tables, the “type”-entry represents the mode of interpretation of the LHS-entries. So, behind the regexp-type an regexp-maschine acts, same with pcre. Hash and betree are only db-formats.
>
> There is no problem to map hash-entries to sql-maps. But I have not found any understanding how to map an regexp or pcre map into sql, because SQL seems to me to be only an storage format. So the “type:map”-scheme seems to mix storage an parsing.
>
> Is this true? I have not found any answer in the Net so far. I want to bring all maps into an graphical SQL-Query-Interface, specially to join maps with same LHS- and different RHS-entries into one sql-table.
>  

it is not about storage nor parsing. its is about lookup. whatever map
you use should return the right answer given a key.

> Here an example:
>
> Regexp-table #1
> /^(.*)(example.com)/                       do_greylisting
>
> Regexp-table #2
> /^(.*)(example.com)/                       FILTER amavis:[127.0.0.1]:10011
>
>
> I want to join them into one table.

what for? if the goal is to ease management, then use a script to
generate postfix maps. but you can use sql statements.

that said, your expressions don't look good, so you may want to
understand regular expressions before taking this trip.

> Combining SQL with regexp-parsing seems to be not implemented.
>  

here is an example
    query = select foo where '%s' regexp '@example\.com$'
that should help you see what you can do with an sql engine...