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 9123223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:17:14+00:00 2026-06-17T06:17:14+00:00

I am using Postgres and I was hoping to create a case insensitive unique

  • 0

I am using Postgres and I was hoping to create a case insensitive unique constraint on my database using DBIx::Class.

I understand that an example like:

__PACKAGE__->add_unique_constraint("table_unique_constraint", ["col_name"]);

would create a unique constraint on a given table.

I am looking for a way to create a case insensitive unique constraint using DBIx::Class to better but it I would say I want to create a unique index that. The SQL query that I am trying to generate is something like:

CREATE UNIQUE INDEX table_unique_constraint ON "table_name"(lower("column_name"));

This example makes sure that I check for entries to be inserted against values in the table without taking into account the case.

Is there any way to add this to the Result? Esp, the catch being the lower().

And of course the DBIx::Class Manual directed me to create constraint instead of a hook for unique index.

  • 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-17T06:17:15+00:00Added an answer on June 17, 2026 at 6:17 am

    DBIx::Class itself doesn’t create DDL queries, so your question doesn’t apply.
    If you use $schema->deploy, that uses SQL::Translator under the hood. I don’t think DBIC can hold such special metadata to control the unique key creation but look at the SQL::Translator docs to be really sure.
    I suggest to create the DDL statements with deployment_statements and modifying the generated ones or use an after deploy method modifier that executes alter SQL statements to make the generated constraints case insensitive.

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

Sidebar

Related Questions

I understand that using postgres on osx is a little difficult because it has
I am using Postgres 9.1 and would like to create a sequence which I
I'm using Postgres and would like to make a big update query that would
I'm using Postgres with Kohana 3's ORM module and would like to run a
I am using Postgres as DBMS and Django. My model that defines the table
im using Postgres 9.0 to save images into the database using 'lo_import' and to
I'm using postgres (postgis) and i want to perform a query that returns all
I am using postgres 9.0 database , where In my C program I connect
I am using Postgres as database and JPA 2.0 as provider. I had been
I am using postgres database in my cakephp project. I have a table with

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.