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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:18:56+00:00 2026-06-16T15:18:56+00:00

My app uses an RDBMS (postgres w/ activerecord) to store and fetch text objects.

  • 0

My app uses an RDBMS (postgres w/ activerecord) to store and fetch text objects. Each text object can have any number of languages associated with it. So far I’ve been thinking of these language associations as tags in my head, much like blog posts can have any number of arbitrary tags. However, these language tags are not arbitrary, and are instead limited to a small set of about 30. In my app a user can request some text objects and supply a set of languages (say English, German, and French) and the app should go ahead and grab some text objects associated with ANY of those languages.

What’s the most effective approach/schema for associating languages with these text objects to make querying easy?

  • 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-16T15:18:57+00:00Added an answer on June 16, 2026 at 3:18 pm

    To make it easy to query you can create a view to avoid the constant joining.

    create table object (
        id serial unique,
        object text primary key
    );
    
    create table tag (
        id serial unique,
        tag text primary key
    );
    
    create table object_tag (
        object_id integer references object(id),
        tag_id integer references tag(id)
    );
    
    insert into tag (tag) values ('English'), ('French'), ('German');
    insert into object (object) values ('o1'), ('o2');
    insert into object_tag (object_id, tag_id) values (1, 1), (1, 2), (2, 3);
    
    create view v_object_tag as
    select o.id object_id, o.object, t.id tag_id, t.tag
    from
        object o
        inner join
        object_tag ot on o.id = ot.object_id
        inner join
        tag t on t.id = ot.tag_id
    ;
    

    Now query as if it were a single table:

    select *
    from v_object_tag
    where tag in ('English', 'German')
    ;
     object_id | object | tag_id |   tag   
    -----------+--------+--------+---------
             1 | o1     |      1 | English
             2 | o2     |      3 | German
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My WinForms app uses a number of BackgroundWorker objects to retrieve information from a
My app uses a BroadcastReceiver and a service to perform background updates. I have
My app uses a logging class which is invoked by each module as it
My rails 3 app uses devise, and we have it set so a user
My app uses gcm. Each time user logs in, new gcm token is registered
My app uses LoadLibrary to load plugins at run-time and users can accidentally try
My app uses two databases (separate files). To handle these databases I have created
My app uses a simple SQLite database. Everything works fine I can now present
Our app uses the send method to call functions on our objects. Unfortunately, some
My app uses WPF Toolkit (http://wpf.codeplex.com). Can anyone tell me what's the proper way

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.