mojolicious / mojolicious/sql-abstract-pg

Allow table aliases in JOIN queries

Open
#3 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
5
Forks
3
PR merge metrics
No merged PRs in 30d

Description

  • SQL::Abstract::Pg version: 1.0
  • Perl version: v5.34
  • Operating system: Ubuntu Linux 21.04

It's not possible to create table aliases in generated SQL queries. This would be useful for generating queries where a table is JOINed to itself. Especially useful if someone wants to create an ORM based on Mojo::Pg.

A suggestion would be to allow the following syntax:

$abstract->select(
    [
        \'"a" as "t1"',
        [ \'"a" as "t2"', '"t2"."parent_id"' => '"t1"."id"' ],
    ],
);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the select API and the proposed self-join syntax in the issue, then trace how JOIN arguments are converted into SQL and review existing query-generation tests. Done means table aliases are accepted and produce valid PostgreSQL for a table joined to itself, with regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl, postgresql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.