Advertisement:

Author Topic: SMF 2.0 beta 3 + postgresql bugs.  (Read 8849 times)

Offline ardbeg

  • Newbie
  • *
  • Posts: 1
SMF 2.0 beta 3 + postgresql bugs.
« on: March 19, 2008, 08:01:58 AM »
I've found 2 bugs in SMF 2.0 beta 3 using postgresql so far.

1, In Sources/Subs-Db-postgresql.php
Code: [Select]
'db_unescape_string' => 'smf_postg_unescape_string',should be
Code: [Select]
'db_unescape_string' => 'smf_db_unescape_string',
2, FIND_IN_SET not avail in postgresql
Code: [Select]
ERROR: function find_in_set(integer, character varying) does not exist
LINE 4: WHERE id_group = 1 OR FIND_IN_SET(1, additional_groups)
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
File: /srv/nfs4/homes/anders/public_html/smf/Sources/Subs-Membergroups.php
Line: 556

« Last Edit: July 27, 2008, 11:11:01 PM by SleePy »

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,942
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: SMF 2.0 beta 3 + postgresql bugs.
« Reply #1 on: March 19, 2008, 11:53:39 AM »
1. Good catch. Apparently the function got renamed between Beta 2.1 and Beta 3...

2. SMF does define a "find_in_set" function for PostgreSQL, but this is only where both parameters are text. Try running this query in phpPgAdmin:

Code: [Select]
CREATE OR REPLACE FUNCTION FIND_IN_SET(integer, character varying) RETURNS boolean AS
  'SELECT
     COALESCE(CAST($1 AS text) = ANY(STRING_TO_ARRAY(CAST($2 AS text), '','')), FALSE) AS result'
LANGUAGE 'sql';

Unfortunately my PostgreSQL test board is down at the moment, but I think that will work.
« Last Edit: March 19, 2008, 11:56:42 AM by Oldiesmann »
Michael Eshom
Cincy Space - now open!

Offline cybernd

  • Newbie
  • *
  • Posts: 5
Re: SMF 2.0 beta 3 + postgresql bugs.
« Reply #2 on: June 23, 2008, 05:07:46 PM »
Your FIND_IN_SET does not fix all issues.

The problem is, that Subs-Post.php is not prepared for the boolean return value.
This leads to a broken send pm functionality. Only moderators will be able to post PMs.

Others will see
Quote
User xxx has blocked your personal message

My quick and dirty fix for beta 3.1:


Replace Subs-Post.php line 1097:
Quote
if (!empty($row['ignored' ]))

with:
Quote
if (!empty($row['ignored' ]) && $row['ignored'] != f)

Maybe it would be better to fix the postgresql function.
But i guess the devs will know what to fix for 2.0 final :)

regards,
Bernhard Neuhauser

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,942
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: SMF 2.0 beta 3 + postgresql bugs.
« Reply #3 on: June 23, 2008, 05:49:38 PM »
Thanks for the info. I'll take a look at it after dinner and report it if necessary :)
Michael Eshom
Cincy Space - now open!

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,942
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: SMF 2.0 beta 3 + postgresql bugs.
« Reply #4 on: June 24, 2008, 11:03:16 AM »
Which version of PostgreSQL are you using?

I just tested this on my PostgreSQL test board using the latest 7.4 release and I was unable to reproduce this.
Michael Eshom
Cincy Space - now open!

Offline cybernd

  • Newbie
  • *
  • Posts: 5
Re: SMF 2.0 beta 3 + postgresql bugs.
« Reply #5 on: June 24, 2008, 01:56:01 PM »
Currently im running ubuntu 8.04tls which has  8.3.3-0ubuntu0.8.04 installed.

Additionally im using the 2.0 beta 3.1 public release so im not aware if your test-branch might already include some fixes in this direction.



Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,942
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: SMF 2.0 beta 3 + postgresql bugs.
« Reply #6 on: June 24, 2008, 05:27:21 PM »
My test board is running the latest development snapshot, but the particular code you referenced hasn't changed in Beta 4. The only difference is that SMF passes the user ID as a string instead of as an integer, so no extra "find_in_set" function is needed (just the one that comes with SMF).

I'll go set up SMF on my virtual machine (openSUSE with PostgreSQL 8.3.3) and see if I can reproduce it on that version of PostgreSQL.
Michael Eshom
Cincy Space - now open!

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,942
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: SMF 2.0 beta 3 + postgresql bugs.
« Reply #7 on: June 24, 2008, 08:14:42 PM »
Tested this in PostgreSQL 8.3.3 using the latest dev release and was able to reproduce it. I'll report it shortly.
Michael Eshom
Cincy Space - now open!

Offline SleePy

  • Let there be light!
  • Site Team Lead
  • SMF Master
  • *
  • Posts: 30,858
  • Gender: Male
  • Thats his happy face.
    • jdarwood007 on GitHub
    • @jdarwood on Twitter
    • SleePy Code - My personal site
Re: SMF 2.0 beta 3 + postgresql bugs.
« Reply #8 on: June 24, 2008, 09:41:24 PM »
Jeremy D — Site Team / SMF Developer
Support the SMF Support team!
Profiles:
GitHub

Offline cybernd

  • Newbie
  • *
  • Posts: 5
Re: SMF 2.0 beta 3 + postgresql bugs.
« Reply #9 on: June 25, 2008, 01:22:28 PM »
thx for the fast investigation ;)

Offline murgh

  • Newbie
  • *
  • Posts: 4
Re: SMF 2.0 beta 3 + postgresql bugs.
« Reply #10 on: February 14, 2009, 10:21:48 AM »
Hi,
I am using SMF 2.0 RC 1 w/ Pg 8.3.6 and the coded solution still is wrong.

In line 1103 the conditions must be ANDed
Code: [Select]
if (!empty($row['ignored']) and strtolower($row['ignored']) === 't')

not ORed.

« Last Edit: February 14, 2009, 10:23:33 AM by murgh »

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,942
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: SMF 2.0 beta 3 + postgresql bugs.
« Reply #11 on: February 21, 2009, 03:05:50 PM »
That will only work for PostgreSQL, and then causes things to break for all other systems (1 isn't the same as 't'). I'll take another look at this issue soon and see what solution I can come up with.
Michael Eshom
Cincy Space - now open!