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

  • SEARCH
  • Home
  • 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 8193983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:39:59+00:00 2026-06-07T04:39:59+00:00

My model looks like this… [PrimaryKey(TaskId)] public class Task { public int TaskId {

  • 0

My model looks like this…

[PrimaryKey("TaskId")]
public class Task
{
    public int TaskId { get; set; }

    [StringLength(1000)]
    [DisplayName("What do you want to do?")]
    public string Description { get; set; }

    [DisplayName("When do you want it done?")]
    [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}", ApplyFormatInEditMode = false)]
    [DataType(DataType.Date)]
    public DateTime CompleteByDate { get; set; }

    public bool IsCompleted { get; set; }

    public DateTime InsertDate { get; set; }
    public DateTime UpdateDate { get; set; }
}

If I try to fetch data from the Task table, one of the first errors I’ll see is this…

ERROR: 42P01: relation "Task" does not exist

The problem, as far as I can tell is that PetaPoco generates sql like this…

SELECT "Task"."TaskId", "Task"."Description", "Task"."CompleteByDate", "Task"."IsCompleted", "Task"."InsertDate", "Task"."UpdateDate" FROM "Task"

So, with the quotes, the capitalization matters and in the DB the column names are only recognized in all lower case if they are put in quotes. I’m wondering if there is a way to change that. The only fix I currently see is to make my model look like this (note capitalization changes)…

[PrimaryKey("taskid")]
[TableName("task")]
public class Task
{
    [Column("taskid")]
    public int taskid { get; set; }

    [StringLength(1000)]
    [DisplayName("What do you want to do?")]
    public string description { get; set; }

    [DisplayName("When do you want it done?")]
    [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}", ApplyFormatInEditMode = false)]
    [DataType(DataType.Date)]
    public DateTime completebydate { get; set; }
    public bool iscompleted { get; set; }
    public DateTime insertdate { get; set; }
    public DateTime updatedate { get; set; }
}

I don’t want my properties to be all lower case. Why do I have to do this, is this the only fix?

  • 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-06-07T04:40:01+00:00Added an answer on June 7, 2026 at 4:40 am

    Petapoco needs the exact (case sensitive) name to match the column, but if you specify the Column attribute, you are free the name the property the way you want (including changing the name)

    [Column("taskid")]
    public int TaskID { get; set; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My model looks like this public IEnumerable<SelectListItem> ProductTypes { get; set; } public ProductContent()
My Model looks like like this public class User { public int ID {
I have a view model that looks like this public class ViewModelRound2 { public
I have a model that looks something like this: public abstract class Parent {
My model looks like this: public class SelectionItem : BaseEntity // BaseEntity ==> id,
My model looks like this: class Staff(models.Model): StaffNumber = models.CharField(max_length=20,primary_key=True) NameFirst = models.CharField(max_length=30,blank=True,null=True) NameLast
I have a model that looks like this: class Invite(models.Model): user = models.ForeignKey(User) event
I am working with a Django model that looks like this: class Subscription(models.Model): user
I have a class in my domain model root that looks like this: namespace
my model looks like this: class MyModel(models.Model): field1 = models.FloatField(default=0) field2 = models.FloatField(default=0) This

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.