[keycloak-user] User attribute value length in SQL database

Stian Thorgersen stian at redhat.com
Tue Aug 11 01:27:14 EDT 2015


Yes, I object to that. That only fixes the issue for those that uses PostgreSQL. Even if you added preconditions for every database with the correct data type it would not be maintainable by us in the long run.

What Marek proposes is the best option IMO. Alternative is we can introduce a new data type mapper in Liquibase that maps text for those databases that don't support it to varchar(max), blob, or whatever it's suitable, but that's really not something we want to do as it would be a maintenance headache for us.

----- Original Message -----
> From: "Tair Sabirgaliev" <tair.sabirgaliev at bee.kz>
> To: keycloak-user at lists.jboss.org, "Marek Posolda" <mposolda at redhat.com>
> Sent: Monday, 10 August, 2015 4:44:34 PM
> Subject: Re: [keycloak-user] User attribute value length in SQL database
> 
> Do you object something like this:
> 
> <databaseChangeLog
>   xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.8"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.8
>          http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.8.xsd">
>     <changeSet author=“ts at bee.kz" id="1.5.1">
> 
>         <preConditions>
>             <dbms type=“postgresql" />
>         </preConditions>
> 
>         <modifyDataType
>             columnName=“value"
>             newDataType=“text"
>             schemaName="public"
>             tableName="user_attribute”/>
>     </changeSet>
> 
> </databaseChangeLog>
> 
> The most interesting part is <preConditions/>
> http://www.liquibase.org/documentation/preconditions.html
>  
> 
> --
> Tair Sabirgaliev
> Bee Software, LLP
> 
> 
> 
> On August 10, 2015 at 19:49:48, Marek Posolda
> (mposolda at redhat.com(mailto:mposolda at redhat.com)) wrote:
> 
> > Hi,
> >  
> > can you try to use "varchar(2048)" instead of "text" ? The potential
> > issue with "text" is, that it's PostgreSQL specific stuff and may not be
> > supported by all databases, which we need to support in Keycloak.
> >  
> > Please let me know if it works and feel free to create JIRA. We will
> > then fix Liquibase script (the thing, which we are using to create DB
> > tables and schema) and in Keycloak 1.5 it will be fixed and the length
> > should suffice. If you can fix and test by yourself and send PR to
> > Keycloak master, it will be even better :-)
> >  
> > Thanks,
> > Marek
> >  
> > On 10.8.2015 10:54, Tair Sabirgaliev wrote:
> > > Hi,
> > >
> > > When configuring Keycloak to use Active Directory we found that some
> > > attributes could not fit into user_attributes.value column in Postgresql.
> > > The problematic values are Cyrillic text. As I suspect, they are encoded
> > > using ASCII charset, thus get longer and don’t fit into default 255
> > > length.
> > > Workaround was to change the column data type:
> > >
> > > alter table user_attribute alter COLUMN value type text;
> > >
> > > Is this the right thing to do considering database evolutions when
> > > migrating from version to version? Can this workaround be incorporated
> > > into Keycloak codebase? At least for Postgresql it is considered safe
> > > performance-wise, references here:
> > >
> > > 1.
> > > http://stackoverflow.com/questions/4848964/postgresql-difference-between-text-and-varchar-character-varying
> > > 2. http://www.depesz.com/2010/03/02/charx-vs-varcharx-vs-varchar-vs-text/
> > >
> > > Thank you!
> > > --
> > > Tair Sabirgaliev
> > > Bee Software, LLP
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > keycloak-user mailing list
> > > keycloak-user at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/keycloak-user
> >  
> 
> 
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user



More information about the keycloak-user mailing list