Announcement

#1 2010-03-29 10:32:35

Hansi
Guest

PostgreSQL installation problem

Hi. As I looked into Piwigo i liked the general concept, but I don't like mySQL, so I was happy to see that 2.1.0 would support PostgreSQL.

But I do get the below error-message (seems like tables and stuff are set up correctly in postgresql). I don't think postgres uses the "set =" syntax?

INSERT INTO piwigo_languages SET id = 'pt_BR', name = 'Brasil [BR]' ;
ERROR: syntax error at or near "SET" LINE 3: SET id = 'pt_BR', ^

 

#2 2010-03-29 10:40:45

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: PostgreSQL installation problem

Hi Hansi,

Nice to see that PostgreSQL is interesting to users. I admit that I believe SQLite is more relevant than PostgreSQL for Piwigo, but the first feedback is from a PostgreSQL user, not an SQLite user :-)

Concerning your problem of insert syntax. I was nearly sure this syntax would not work with something else than MySQL.

@nicolas : I will add a:

Code:

pwg_db_simple_insert(
    LANGUAGES_TABLE,
    array(
        'id' => 'pt_BR',
        'name' => 'Brasil [BR]',
    )
);

(simpler than mass_insert)

Offline

 

#3 2010-03-29 11:50:53

nicolas
Former Piwigo Team
2004-12-30
1232

Re: PostgreSQL installation problem

plg wrote:

@nicolas : I will add a:

Code:

pwg_db_simple_insert(
    LANGUAGES_TABLE,
    array(
        'id' => 'pt_BR',
        'name' => 'Brasil [BR]',
    )
);

(simpler than mass_insert)

I propose to use the standard syntax of "INSERT INTO" :

Code:

insert into (COLUMNS) values(VALUES)

I didin't see that syntax (insert into set ...) before !

Offline

 

#4 2010-03-29 12:05:29

nicolas
Former Piwigo Team
2004-12-30
1232

Re: PostgreSQL installation problem

The problem is the same in admin/include/themes.class.php.

Offline

 

#5 2010-03-29 12:08:07

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: PostgreSQL installation problem

nicolas wrote:

I propose to use the standard syntax of "INSERT INTO" :

Code:

insert into (COLUMNS) values(VALUES)

I didin't see that syntax (insert into set ...) before !

It's a matter of readibility. The "standard" syntax is less readable. This is why I've used the "insert into set" syntax (and P@t reused it in language manager).

Because yes, we like to have more readable code, I think that:

Code:

pwg_db_simple_insert(
    LANGUAGES_TABLE,
    array(
        'id' => 'pt_BR',
        'name' => 'Brasil [BR]',
    )
);

is more readable than:

Code:

$query = '
INSERT INTO '.LANGUAGES_TABLE.'
  (id, name)
  VALUES
  ("pt_BR", "Brasil [BR]")
;';
pwg_query($query);

The more you add columns, the more readable pwg_db_simple_insert is, compared to "insert into values".

Offline

 

#6 2010-03-29 14:29:22

nicolas
Former Piwigo Team
2004-12-30
1232

Re: PostgreSQL installation problem

plg wrote:

nicolas wrote:

I propose to use the standard syntax of "INSERT INTO" :

Code:

insert into (COLUMNS) values(VALUES)

I didin't see that syntax (insert into set ...) before !

It's a matter of readibility. The "standard" syntax is less readable. This is why I've used the "insert into set" syntax (and P@t reused it in language manager).

Because yes, we like to have more readable code, I think that:

Code:

pwg_db_simple_insert(
    LANGUAGES_TABLE,
    array(
        'id' => 'pt_BR',
        'name' => 'Brasil [BR]',
    )
);

is more readable than:

Code:

$query = '
INSERT INTO '.LANGUAGES_TABLE.'
  (id, name)
  VALUES
  ("pt_BR", "Brasil [BR]")
;';
pwg_query($query);

The more you add columns, the more readable pwg_db_simple_insert is, compared to "insert into values".

And the code of pwg_db_simple_insert function is the same as the one I proposed ? If yes, it's ok for me.

Offline

 

#7 2010-03-29 14:35:04

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: PostgreSQL installation problem

nicolas wrote:

I didin't see that syntax (insert into set ...) before !

+1
If someone has a link to (insert into set ...) I will be interested in.

http://www.postgresql.org/docs/8.4/inte … nsert.html


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#8 2010-03-29 14:48:10

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: PostgreSQL installation problem

Any way, languages table is missing in piwigo_structure-pgsql and piwigo_structure-sqlite.sql...
And there is still pwg_stuffs table????

nicolas, can you fix it?


P@t

Offline

 

#9 2010-03-29 15:02:28

nicolas
Former Piwigo Team
2004-12-30
1232

Re: PostgreSQL installation problem

P@t wrote:

Any way, languages table is missing in piwigo_structure-pgsql and piwigo_structure-sqlite.sql...
And there is still pwg_stuffs table????

nicolas, can you fix it?

FIx is ready on my working copy. I wait for acceptance on my proposition ?

Offline

 

#10 2010-03-29 15:14:04

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: PostgreSQL installation problem

nicolas wrote:

And the code of pwg_db_simple_insert function is the same as the one I proposed ? If yes, it's ok for me.

If we have a clean function pwg_db_simple_insert then we can use "insert into values" syntax, which is compatible everywhere I suppose.

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact