* Michael Parker <[EMAIL PROTECTED]> [2007-01-30 07:53:23 -0600]: > Kim Christensen wrote: > > * Jorge Cardona <[EMAIL PROTECTED]> [2007-01-29 23:48:52 -0500]: > > > >> Hi. > >> I got a question about this parameter, the spamassassin documentation > >> tells this: > >> > >> 1) Current default query: > >> SELECT preference, value FROM _TABLE_ WHERE username = _USERNAME_ > >> OR username = '@GLOBAL' ORDER BY username ASC > >> > >> 2) Use global and then domain level defaults: > >> SELECT preference, value FROM _TABLE_ WHERE username = _USERNAME_ > >> OR username = '@GLOBAL' OR username = '@~'||_DOMAIN_ ORDER BY username > >> ASC > >> > >> 3) Maybe global prefs should override user prefs: > >> SELECT preference, value FROM _TABLE_ WHERE username = _USERNAME_ > >> OR username = '@GLOBAL' ORDER BY username DESC > >> > >> In 1) and 3) is possible that the query return a table with 2 users > >> ,@GLOBAL, and the user that call spamassassin, what i understand it's > >> that SA only use the preferences for the first user , thats why in 3) > >> the global overrride the user prefs ("ORDER BY username DESC"). > >> > >> What i can't understand is whats do the 2) query, and also his > >> description, "Use global and then domain level defaults" . > >> Spamassassin use all the prefs from the @GLOBAL and work with it, and > >> after that use the Domains prefs and wort again, thats what its does? > >> or take the @GLOBAL prefs, and then override the prefs with the > >> Domains prefs.? > >> > >> Please, can anyone explain to me this? > > > > As Michael said, your query will simply return ALL rows matching your > > control statements. You need to limit the query to return the first > > matching row, by simply adding "LIMIT 1" to the end of the query. > > > > SELECT preference, value FROM _TABLE_ WHERE username = _USERNAME_ \ > > OR username = '@GLOBAL' OR username = '@~'||_DOMAIN_ \ > > ORDER BY username ASC LIMIT 1 > > > > You DON'T want to do this. > > If you did that then you could only have 1 config row.
My bad, I was thinking way ahead of the case - I thought he wanted to fetch a certain preference instead of all possible ones. Too much coffee makes your brain dance, I guess :-) Best wishes -- Kim Christensen "I wanted to put a bullet between the eyes of every panda that wouldn't screw to save its species"