pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedCONCAT function equivalent
8+ messages / 3 participants
[nested] [flat]
* CONCAT function equivalent
@ 2014-05-17 14:20 Fabian Santiago <fabian.santiago@gmail.com>
0 siblings, 2 replies; 8+ messages in thread
From: Fabian Santiago @ 2014-05-17 14:20 UTC (permalink / raw)
To: pgsql-admin
Hello,
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.
--
Sincerely,
Fabian S.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: CONCAT function equivalent
@ 2014-05-17 15:03 David G Johnston <david.g.johnston@gmail.com>
parent: Fabian Santiago <fabian.santiago@gmail.com>
1 sibling, 1 reply; 8+ messages in thread
From: David G Johnston @ 2014-05-17 15:03 UTC (permalink / raw)
To: pgsql-admin
Fabian Santiago wrote
> Hello,
>
> 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.
>
> --
> Sincerely,
>
> Fabian S.
Not in core or contrib
Could write one relatively easily in 9.0 but not sure how you'd manage in
8.4
8.4 is also going out of support soon
Coalesce and || are your tools if you stick to 8.4
David J.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/CONCAT-function-equivalent-tp5804325p5804327.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: CONCAT function equivalent
@ 2014-05-17 20:04 Korry Douglas <korry.douglas@enterprisedb.com>
parent: Fabian Santiago <fabian.santiago@gmail.com>
1 sibling, 1 reply; 8+ messages in thread
From: Korry Douglas @ 2014-05-17 20:04 UTC (permalink / raw)
To: Fabian Santiago <fabian.santiago@gmail.com>; +Cc: pgsql-admin
> 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
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: CONCAT function equivalent
@ 2014-05-17 21:18 Fabian Santiago <fabian.santiago@gmail.com>
parent: Korry Douglas <korry.douglas@enterprisedb.com>
0 siblings, 2 replies; 8+ messages in thread
From: Fabian Santiago @ 2014-05-17 21:18 UTC (permalink / raw)
To: Korry Douglas <korry.douglas@enterprisedb.com>; +Cc: pgsql-admin
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.douglas@enterprisedb.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
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: CONCAT function equivalent
@ 2014-05-17 22:41 David G Johnston <david.g.johnston@gmail.com>
parent: Fabian Santiago <fabian.santiago@gmail.com>
1 sibling, 1 reply; 8+ messages in thread
From: David G Johnston @ 2014-05-17 22:41 UTC (permalink / raw)
To: pgsql-admin
Fabian Santiago wrote
> It created one line in the column with everything strung together.
And why would you expect anything different? If you want embedded newlines
you need to add them yourself during the concatenation.
See my post on the -novice list where you also posted this same original
question.
David J.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/CONCAT-function-equivalent-tp5804325p5804370.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: CONCAT function equivalent
@ 2014-05-18 00:01 Fabian Santiago <fabian.santiago@gmail.com>
parent: Fabian Santiago <fabian.santiago@gmail.com>
1 sibling, 0 replies; 8+ messages in thread
From: Fabian Santiago @ 2014-05-18 00:01 UTC (permalink / raw)
To: Korry Douglas <korry.douglas@enterprisedb.com>; +Cc: 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.santiago@gmail.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.douglas@enterprisedb.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
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: CONCAT function equivalent
@ 2014-05-18 01:01 Fabian Santiago <fabian.santiago@gmail.com>
parent: David G Johnston <david.g.johnston@gmail.com>
0 siblings, 0 replies; 8+ messages in thread
From: Fabian Santiago @ 2014-05-18 01:01 UTC (permalink / raw)
To: David G Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-admin
Thanks David. You were right. It is what I should have expected. I figured
it all out finally. Thanks for your guidance.
On Sat, May 17, 2014 at 6:41 PM, David G Johnston <
david.g.johnston@gmail.com> wrote:
> Fabian Santiago wrote
> > It created one line in the column with everything strung together.
>
> And why would you expect anything different? If you want embedded newlines
> you need to add them yourself during the concatenation.
>
> See my post on the -novice list where you also posted this same original
> question.
>
> David J.
>
>
>
> --
> View this message in context:
> http://postgresql.1045698.n5.nabble.com/CONCAT-function-equivalent-tp5804325p5804370.html
> Sent from the PostgreSQL - admin mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>
--
Sincerely,
Fabian S.
862-432-2373
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: CONCAT function equivalent
@ 2014-05-18 01:02 Fabian Santiago <fabian.santiago@gmail.com>
parent: David G Johnston <david.g.johnston@gmail.com>
0 siblings, 0 replies; 8+ messages in thread
From: Fabian Santiago @ 2014-05-18 01:02 UTC (permalink / raw)
To: David G Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-admin
I upgraded to v9.1 and that solved a lot of my hurt. Thanks.
On Sat, May 17, 2014 at 11:03 AM, David G Johnston <
david.g.johnston@gmail.com> wrote:
> Fabian Santiago wrote
> > Hello,
> >
> > 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.
> >
> > --
> > Sincerely,
> >
> > Fabian S.
>
> Not in core or contrib
>
> Could write one relatively easily in 9.0 but not sure how you'd manage in
> 8.4
>
> 8.4 is also going out of support soon
>
> Coalesce and || are your tools if you stick to 8.4
>
> David J.
>
>
>
>
>
> --
> View this message in context:
> http://postgresql.1045698.n5.nabble.com/CONCAT-function-equivalent-tp5804325p5804327.html
> Sent from the PostgreSQL - admin mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>
--
Sincerely,
Fabian S.
862-432-2373
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2014-05-18 01:02 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-05-17 14:20 CONCAT function equivalent Fabian Santiago <fabian.santiago@gmail.com>
2014-05-17 15:03 ` David G Johnston <david.g.johnston@gmail.com>
2014-05-18 01:02 ` Fabian Santiago <fabian.santiago@gmail.com>
2014-05-17 20:04 ` Korry Douglas <korry.douglas@enterprisedb.com>
2014-05-17 21:18 ` Fabian Santiago <fabian.santiago@gmail.com>
2014-05-17 22:41 ` David G Johnston <david.g.johnston@gmail.com>
2014-05-18 01:01 ` Fabian Santiago <fabian.santiago@gmail.com>
2014-05-18 00:01 ` Fabian Santiago <fabian.santiago@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox