xlat expansion of absent VPs

Arran Cudbard-Bell a.cudbardb at freeradius.org
Tue Jun 18 14:02:08 CEST 2013


On 18 Jun 2013, at 12:31, Phil Mayers <p.mayers at imperial.ac.uk> wrote:

> On 18/06/13 12:08, Arran Cudbard-Bell wrote:
>> 
>> On 18 Jun 2013, at 11:07, Phil Mayers <p.mayers at IMPERIAL.AC.UK> wrote:
>> 
>>> On 06/18/2013 07:27 AM, Brian Candler wrote:
>>> 
>>>> Aside: I think Postgres will reject a quoted string being used in an
>>>> integer context.
>>> 
>>> Not correct:
>>> 
>>> db=> create temp table tt (val integer);
>>> CREATE TABLE
>>> db=> insert into tt values ('1');
>>> INSERT 0 1
>> 
>> Will it converted quoted NULLs 'NULL' to actual NULL values? I'm guessing no?
> 
> No. That's what NULLIF is for, and it's widely used for that.
> 
> TBH we're running into the limitations of using variable interpolation for SQL here; the "right" way to do this would be parameter binding and passing typed data into the SQL drivers, but that's a lot of work for only a very small incremental gain.

We discussed that, and it seems like it could be done if we added callbacks for xlat parsing during xlat registration. Then all the pre-prepared statements could be created during startup.

The key unknowns with this, is whether a connection is required to the server in order to create the bound statements, and whether it's ok to share them between multiple handles.

> It's very, very common in SQL for writers of queries to have to use COALESCE, NULLIF, CASE, type coercion and other features to ensure proper data values (or for the SQL DB to infer them).

OK.

> As far as I'm concerned, the *only* thing FreeRADIUS needs to do is properly quote the variables it expands into a SQL query, which it already does.

OK. Then the default substitution should probably only be done for certain modules where it is an issue. 

On the command line blank arguments do affect programs which use positional arguments as multiple chars of whitespace are condensed.

Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS Development Team



More information about the Freeradius-Devel mailing list