Choice of Database schema for storing folder system

Your first schema will work just fine. When you put an index on the FullPath column, use either the case-sensitive BETWEEN operator for queries, or use LIKE with either COLLATE NOCASE on the index or with PRAGMA case_sensitive_like. Please note that this schema also stores all parents, but the IDs (the names) are all concatenated … Read more

Unit-Testing Databases

There’s no real way to unit test a database other than asserting that the tables exist, contain the expected columns, and have the appropriate constraints. But that’s usually not really worth doing. You don’t typically unit test the database. You usually involve the database in integration tests. You typically use your favourite automated unit testing … Read more

How to add a user to PostgreSQL in Windows?

In pgadmin you can create a new “Login Role” and name it Eric and give it permissions graphically, or from command line you can do something like this psql -U postgres -c “CREATE ROLE Eric LOGIN NOSUPERUSER INHERIT CREATEDB CREATEROLE;” mydb see http://developer.postgresql.org/pgdocs/postgres/sql-createrole.html for information on the CREATE ROLE options.

One table or many? [closed]

I’d go for having a single table for all references, but additional tables like BookReferences and so on for metadata not applicable for all reference types. Searching and querying would not be more difficult – after all you could just create a view which aggregates all information as in the single-table solution, and then query … Read more

how to drop all databases except few ones in postgres

First, execute the following query in the psql terminal. select ‘drop database “‘||datname||'”;’ from pg_database where datistemplate=false; This will generate drop database command for all the databases. Copy the result in a text editor and exclude(delete) what you want to keep and save it as dd.sql file. And execute it like this: psql -d postgres … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)