Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am building up a rails application that I cloned from my friend. I am using Ubuntu 13.10, rails 3.2.14. I am using a postgresql database and when I try to run rake db:migrate it gives me some error like this:

PG::UndefinedObject: ERROR: type "json" does not exist LINE 1: ALTER TABLE "filters" ADD COLUMN "search_string" json

I installed pg version :- 9.3.1

running rails db output is :-psql (9.3.1, server 9.1.10)

running select version(); :-PostgreSQL 9.1.10 on i686-pc-linux-gnu

Why is it showing psql -version different from the version connected to my database??

My friend is working on 9.2.4 I don't know why this error is occurring, I tried several times to downgrade using purge or remove commands to remove 9.3.1 all goes well but when I check psql --version it again shows me 9.3.1 . Any solution ???

share|improve this question
add comment

2 Answers 2

up vote 0 down vote accepted

Because you probably have different client and server version packages installed. First, I'd check what packages you have installed:

dpkg -l | grep postgresql

Then install the 9.3 server package if you don't already have it.

If you already have it, check what clusters you have running:

pg_lsclusters

If you don't already have a 9.3 cluster, make one (pg_createcluster). If you do, note the port number and make sure you connect to that one.

share|improve this answer
add comment

Postgres 9.2 is not packaged for Ubuntu 13.10, but 9.1 is. Try to do it like this:

sudo apt-get purge postgresql*

sudo apt-get autoremove

sudo apt-get install postgresql-9.1
share|improve this answer
    
Hey Luis I run the first command it gives me output:- E: Unable to locate package postgresql-8.4.9.tar.gz E: Couldn't find any package by regex 'postgresql-8.4.9.tar.gz' E: Unable to locate package postgresql-8.4.9.tar.gz.1 E: Couldn't find any package by regex 'postgresql-8.4.9.tar.gz.1' –  peeyush singla Nov 7 '13 at 5:52
    
If I am at my home path then it gives me this error :- E: Unable to locate package postgresql-9.2.4 E: Couldn't find any package by regex 'postgresql-9.2.4' E: Unable to locate package postgresql-9.2.4.tar.gz In my project 8.4.9 file was present I removed that using rm and now it is giving me :- zsh: no matches found: postgresql* –  peeyush singla Nov 7 '13 at 6:06
    
If I am running :- sudo apt-get autoremove Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded. After this when I am running sudo apt-get install postgresql-9.1 Reading package lists... Done Building dependency tree Reading state information... Done postgresql-9.1 is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded. –  peeyush singla Nov 7 '13 at 6:09
    
Then it seems you have postgres 9.1 already installed. What version are you getting inside psql? –  Luís de Sousa Nov 7 '13 at 10:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.