Git Product home page Git Product logo

Comments (4)

trappist avatar trappist commented on August 16, 2024

I took care of it by adding a integer=boolean operator like so:

CREATE OR REPLACE FUNCTION inttobool(integer, boolean) RETURNS boolean
AS $$
SELECT CASE WHEN $1=0 and NOT $2 OR ($1<>0 and $2) THEN true ELSE false END
$$
LANGUAGE sql;

CREATE OR REPLACE FUNCTION inttobool(boolean, integer) RETURNS boolean
AS $$
SELECT inttobool($2, $1);
$$
LANGUAGE sql;

CREATE OR REPLACE FUNCTION notinttobool(boolean, integer) RETURNS boolean
AS
$$
SELECT NOT inttobool($2,$1);
$$
LANGUAGE sql;

CREATE OR REPLACE FUNCTION notinttobool(integer, boolean) RETURNS boolean
AS $$
SELECT NOT inttobool($1,$2);
$$
LANGUAGE sql;

CREATE OPERATOR = (
PROCEDURE = inttobool,
LEFTARG = boolean,
RIGHTARG = integer,
COMMUTATOR = =,
NEGATOR = <>
);

CREATE OPERATOR <> (
PROCEDURE = notinttobool,
LEFTARG = integer,
RIGHTARG = boolean,
COMMUTATOR = <>,
NEGATOR = =
);

CREATE OPERATOR = (
PROCEDURE = inttobool,
LEFTARG = integer,
RIGHTARG = boolean,
COMMUTATOR = =,
NEGATOR = <>
);

CREATE OPERATOR <> (
PROCEDURE = notinttobool,
LEFTARG = boolean,
RIGHTARG = integer,
COMMUTATOR = <>,
NEGATOR = =
);

from redmine-gitosis.

manern avatar manern commented on August 16, 2024

WARNING: The first comment in this thread is not going to fix it - close but not quite (the to_i on line 13 will break it!)

I just ran into and fixed this today - there are four options (ordered from simplest to most invasive):

  1. Add apostrophes around active's value in the SQL so it is interpreted as a literal (gitosis_public_key_controller.rb, line 15):
    c = ARCondition.new(@status ? ["active='?'", @status] : nil)
  2. Instead of 1/0, use TRUE/FALSE which is the true SQL-92 (section 8.12) compliant way. This requires some slight changes to the gitosis_public_keys controller and model, but more than the first poster indicated.
  3. Define active as an integer instead in the database table.
  4. Add the integer/bool operator to PostgreSQL.

from redmine-gitosis.

jschuhmacher avatar jschuhmacher commented on August 16, 2024

I missed that one, thanks for the warning.

from redmine-gitosis.

thafreak avatar thafreak commented on August 16, 2024

Oops, I apparently re-reported this issue. Is there any time frame for a fix to be released?

from redmine-gitosis.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.