I would like to use icu collation in PostgreSQL with rails application.
I specified icu collation at database.yml like this,
adapter: postgresql
ctype: ja-x-icu
collation: ja-x-icu
but I got the following error:
Caused by:
PG::WrongObjectType: ERROR: invalid locale name: "ja-x-icu"
I found some questions which said that we cannot use icu collation in "CREATE DATABASE".
Get und-x-icu as collation and character type in Postgres 10 and win server 2008
Is this situation still the same as this question now?
If so, how can I create database with icu collation?
Thank you in advance.
(I'm using Rails 7 and Postgres 11 but I can move to further version if necessary.)
That is only supported with PostgreSQL v15 or better.
If you are using v15 or better, I guess your mistake is that you simply used
initdb --encoding=UTF8 --locale=ja-x-icu datadir
The files belonging to this database system will be owned by user "laurenz".
This user must also own the server process.
initdb: error: invalid locale name "ja-x-icu"
You have to do that differently:
initdb --encoding=UTF8 \
--locale-provider=icu --locale=ja_JP.utf8 --icu-locale=ja-x-icu datadir
Use --locale for the C library locale. Even if you are using an ICU collation (--icu-locale=ja-x-icu --locale-provider=icu), you have to specify a C library locale as well.
Related
I'm following this doc: https://neo4j.com/developer/manage-multiple-databases
If we want to see the system information (view, create/delete, manage databases), we will need to switch to the system database.
We can do that with the :use command then telling it which database we want.
Command: :use system
Results:
But when I try it locally it says:
UnknownCommandError: Unknown command :use system
Am I doing it wrong?
As mentioned in the manual you have quoted:
Prerequisites
Please have Neo4j (version 4.0 or later) downloaded and
installed. It helps to have read the section on graph databases.
In Neo4j (v4.0+), we can create and use more than one active database
at the same time
And you seem to be using v3.5.1. Hence the issue.
Please upgrade to v4.0+ to be able to manage multiple databases.
In Neo4j 3.5.x or below, you can use change the neo4j.conf config property dbms.active_database to change which database the dbms will use, this may be easier for you than replacing file contents.
I have recently updated Fedora 21 to 25. I thought I had caught most issues and decided it was time to update Rails and postgresql but I am stuck on the latter.
Postgresql was functioning without visible issues prior to updating to Fedora 25. I can access my database through my Rails application and have CRUD functions so I believe the database is still good.
But, if I try to open postgresql CLI using psql database_name I can not access the database and receive the following error message:
psql: symbol lookup error: psql: undefined symbol: PQsslInUse
I get the same error for anything calling psql, i.e. psql --version gives the same error.
The command postgresql-setup upgrade tells me I am "using obsoleted argument syntax" and states arguments transformed to: postgresql-setup --upgrade --unit postgresql. This generates the following error:
ERROR: Cannot upgrade because the database in /var/lib/pgsql/data is of
version 9.3 but it should be 9.4
When I look at the above directory it appears that I have 2 data directories, the one noted above that holds a file PG_VERSION that stores 9.3 and there is also /var/lib/pgsql/9.4/data that holds a file PG_VERSION that stores 9.4.
So, how do I find out which database version has my current database? If I have been operating on postgresql 9.3 how do I move to 9.4 and then to 9.5 (eventually to 9.6!).
I need to recreate a SQLite database programmatically under iOS from a malformed database using this command. Which is original from: How to recover a corrupt SQLite3 database?
$ sqlite3 mydata.db ".dump" | sqlite3 new.db
or a equivalent command like this.
$ sqlite3 test.db '.dump' > dbbackup
Scenario: I need a function in my App which could detect the malformed Sqlite database and repair it self.
I used the sqlite3_backup- functions to recreate it, but the recreated database also malformed. But the database which was created with the help of the first command seems to be ok.
But the command is only for terminal and how can I trigger using iOS programmatically?
NB: Any other way to solve the problem also welcomed.
I tried creating sqlite3 database in my MAC OS X machine using the xxx.sql script file. But I am getting an error. The sql file is created on Windows system.
Command I used:
sqlite3 bizApp1.sqlite < DBCreationScript_8thNov2012_New.sql
Result:
Error: incomplete SQL: ??/
The error seems to be a syntax error.
If you're a beginner you can use an easy soft like SQLite Data Browser
I'm used to creating the PDO object with something like this in the 4th parameter (driver options):
array(\PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES {$this->charset} COLLATE {$this->collation}")
How can I tell symfony 2 to do this? In the configuration file I can only see a 'charset' option.
I also need to create all the tables with a specific collation: utf8_unicode_ci
What can I do to have all the tables created through the command line be created with that collation instead of latin1?
I have been facing the same problem. It seems that has to do with DBAL configuration. I have found in the PDO documentation the following under the PDO_MYSQL DSN — Connecting to MySQL databases:
charset Currently ignored.
My solution was to apply the collation manually at the database level. Then all tables created in Symfony2 with the schema update command will have the correct collation.
I also added this line to my Sf2 doctrine: dbal configuration in the config.yml:
charset: utf8