From: | Fabian Santiago <fabian(dot)santiago(at)gmail(dot)com> |
---|---|
To: | Korry Douglas <korry(dot)douglas(at)enterprisedb(dot)com> |
Cc: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: CONCAT function equivalent |
Date: | 2014-05-18 00:01:56 |
Message-ID: | CAP4E923rPgHfoDD97t7kFcq=f9hT0HoAUmeVbNg+FT9zZg-wzw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Thanks Korry,
After much investigation, your example:
UPDATE domain SET settings = settings || 'default_language:' ||
defaultlanguage || ';';
gave me what I was looking for after all. at first i didn't think so but
after looking into it further (and a few smoke breaks to clear the head), i
discovered it was correct. Thanks a lot.
- Fabian S.
On Sat, May 17, 2014 at 5:18 PM, Fabian Santiago
<fabian(dot)santiago(at)gmail(dot)com>wrote:
> Thanks Korry,
>
> I think that's a step in the right direction but I'm not quite there yet.
> I'm trying to run this series of commands:
>
> sql> UPDATE domain SET settings=CONCAT(settings, 'default_language:', defaultlanguage, ';');
> sql> UPDATE domain SET settings=CONCAT(settings, 'default_user_quota:', defaultuserquota, ';');
> sql> UPDATE domain SET settings=CONCAT(settings, 'default_groups:', defaultuseraliases, ';');
> sql> UPDATE domain SET settings=CONCAT(settings, 'min_passwd_length:', minpasswordlength, ';');
> sql> UPDATE domain SET settings=CONCAT(settings, 'max_passwd_length:', maxpasswordlength, ';');
> sql> UPDATE domain SET settings=CONCAT(settings, 'disabled_domain_profiles:', disableddomainprofiles, ';');
> sql> UPDATE domain SET settings=CONCAT(settings, 'disabled_user_profiles:', disableduserprofiles, ';');
>
>
> When I did it this way:
>
> UPDATE domain SET settings =
> ('default_language:en_US;default_user_quota:10240;default_groups:;min_passwd_length:0;max_passwd_length:0;disabled_domain_profiles:;disabled_user_profiles:;');
>
> It created one line in the column with everything strung together.
>
> I'm trying to get everything into individual lines. When I run separate
> statements using your approach, it created two lines (I think because one
> of the other tables, defaultuserquota, contained two values itself.
>
> So I'm still stuck. Does anyone else have any clues? Or am I totally
> mis-thinking this completely? Thanks.
>
> - Fabian S.
>
>
>
> On Sat, May 17, 2014 at 4:04 PM, Korry Douglas <
> korry(dot)douglas(at)enterprisedb(dot)com> wrote:
>
>> Is there an equivalent command (string) for this example:
>>
>> UPDATE domain SET settings=CONCAT(settings, 'default_language:',
>> defaultlanguage, ';');
>>
>> that works and accomplishes the same thing in postgresql v8.4? Thanks.
>>
>>
>> The concatenation operator is available in 8.4, is there some reason that
>> won't work for you?
>>
>> UPDATE domain SET settings = settings || 'default_language:' ||
>> defaultlanguage || ';';
>>
>>
>> -- Korry
>>
>>
>
>
> --
> Sincerely,
>
> Fabian S.
> 862-432-2373
>
--
Sincerely,
Fabian S.
862-432-2373
From | Date | Subject | |
---|---|---|---|
Next Message | Fabian Santiago | 2014-05-18 01:01:33 | Re: CONCAT function equivalent |
Previous Message | David G Johnston | 2014-05-17 22:41:52 | Re: CONCAT function equivalent |