Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7036943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:29:03+00:00 2026-05-28T01:29:03+00:00

I am migrating from a test SQLite database to a PostgreSQL database. I have

  • 0

I am migrating from a test SQLite database to a PostgreSQL database.

I have a sample object that is inserted in the database, that worked on SQLite but is giving me an error in PostgreSQL.

Code snippet is:

car = CarItem.objects.create(
    user = motor_trend,
    name = 'Camaro 2010',
    category = cars,
    condition = 'Used',
    price = '28,547.00',
    production_year = '2010',
    color_interior = 'Black',
    color_exterior = 'Inferno Orange Metallic',
    reference = 'PRC17288',
    location_of_creation = 'Undisclosed',
    location_current = 'Columbus, OH, USA',
    description = 'GORGEOUS ORANGE SS!!',
)
car.save()

I am getting a:

DatabaseError at /create/
value too long for type character varying(512)

Traceback
(...)
    description = 'GORGEOUS ORANGE SS!!',
(...)

The description field of my model has a 512 max char length:

description = models.CharField(max_length=512,default='')

But there is no way that string is over 512 bytes.

I have read previous posts about this error, one referring to the encoding. Does not appear to be the case.

I am hosted on Webfaction. I created a database, with utf-8 encoding, and proceeded to use syncdb. Syncdb worked perfectly but now this object insertion fails.

Can somebody give some input? Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:29:03+00:00Added an answer on May 28, 2026 at 1:29 am

    After some digging in the Django documentation:

    Character fields

    Any fields that are stored with VARCHAR column types have their
    max_length restricted to 255 characters if you are using unique=True
    for the field.

    Emphasis mine. Do you have unique=True for the field?
    This is a Django restriction, PostgreSQL wouldn’t mind. You might want to switch to data type text. TextField in Django parlance.


    Old ideas:

    user is a reserved word in PostgreSQL and any SQL standard. Don’t use it as column name.

    You could use it, if you enclosed it in double quotes, but stay away from that folly. Just don’t use reserved words for identifiers. Ever.

    Also …

    user = motor_trend,
    name = 'Camaro 2010',
    category = cars,
    

    Any particular reason why motor_trend and cars are not quoted like the other values? Foreign keys, like @Ignacio commented?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a test server that uses data from a test database. When I'm
Migrating app from php. and have this in the view: <%=render :partial => jt-test,
We're finally migrating our unit test code base from JUnit 3 to JUnit 4.
We are migrating our test report data (unit, regression, integration, etc..) from an XML
Does anyone have any experience migrating from one DBMS to another? If you have
I am migrating a project from NHibernate 1.2 to Nhibernate 2.1, and I have
I have a problem migrating from Delphi 2006 to Delphi 2009. A Project which
I am doing some research on migrating away from Microsoft sql server to postgresql
Ok, have a client that has existing links coming in from searchmarketing. I am
I'm doing a migration from sqlite to oracle backend. The oracle database already exists

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.