djplaner / moodle-mod_bim

A Moodle activity module the provides support for managing/marking individual student blogs hosted on external services.
http://davidtjones.wordpress.com/research/bam-blog-aggregation-management/
7 stars 2 forks source link

PostgreSQL backup issues with lack of table name alias #9

Closed tlock closed 14 years ago

tlock commented 14 years ago

In functions like :-

backuplib.php: bim_marking_ids_by_course

The SQL table name alias needs to be specified in PSQL :-

return get_records_sql(
          "SELECT m.id,m.bim " .
              "FROM {$CFG->prefix}marking m, {$CFG->prefix}bim bim" .
          "WHERE bim.course='$course' AND m.bim=bim.id" );

Previously :-

return get_records_sql(
          "SELECT m.id,m.bim " .
              "FROM {$CFG->prefix}marking m, {$CFG->prefix}bim " .
          "WHERE bim.course='$course' AND m.bim=bim.id" );
djplaner commented 14 years ago

Thanks for point this out. Have fixed this up in the code on github. It seems to work, but I don't have Postgres so haven't tested there and I've done this in a hurry.

tlock commented 14 years ago

This SQL would fail because there is no space after the table alias

"FROM {$CFG->prefix}marking m, {$CFG->prefix}bim bim" .

TO

"FROM {$CFG->prefix}marking m, {$CFG->prefix}bim bim " .

tlock commented 14 years ago

my bad...

djplaner commented 14 years ago

Ahh, that's what you get when you don't think. I should've picked up the need for a space. So much for getting a quick response. Must take care.

Again, thanks for the feedback.

Wonder if I've introduced another problem?