這是發生在11/25將Drupal 核心由7.8升級到7.9
並將views模組由rc1升級到rc3所發生的references模組(node_reference/node_reference.module)之問題
問題如下:
Debug:
‘Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column \’field_data_field_course.nid\’ in \’on clause\"
於 views_plugin_query_default->execute() (/var/www/html/show-win/sites/all/modules/views-rc3/plugins/views_plugin_query_default.inc 中的第 1386 行)。

發生錯誤畫面
===========以下這篇大作#11的回覆patch檔案搞定======
Exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column ..
參考:http://drupal.org/node/1275096#comment-4981442
The patch in #11 fixed my issue. Thanks!
=========Patch file=======
http://drupal.org/files/issues/column_not_found_1054_unkonw_column-1275096-11.patch
=======
解決辦法:by Gigo 2011/11/26
- 將上面的檔案更名為new.patch,並下載上傳到 /sites/all/modules/new.patch
- 利用linux的patch指令:(在哪邊執行以下的指令呢?答案是:modules/ )
patch -p1 < new.patch
- 到drupal的後台管理->設定->效能 清除所有的catch
- 搞定
————————
參考如下:
http://drupal.org/patch
What is a patch?
http://drupal.org/node/367392
Making a Drupal patch with Git
製作patch, 使用patch的方法
http://childblue.blogspot.com/2006/12/patch-patch_22.html
製作patch, 使用patch的方法
原文出處
製作patch
diff -Naur olddir newdir > new-patch
製作patch要注意的事項
記得要讓前置的目錄階層數有相同的深度,例如:
— old/modules/pcitable Mon Sep 27 11:03:56 1999
+++ new/modules/pcitable Tue Dec 19 20:05:41 2000
上面用diff產生的結果,可以給patch使用
— old/try1/other/modules/pcitable Mon Sep 27 11:03:56 1999
+++ new/modules/pcitable Tue Dec 19 20:05:41 2000
但是上面產生的結果在使用上可能會發生問題,第一行目錄的深度有四層,而第二行只有兩層. 這裡建議直接修改 —和+++後面的內容讓目錄結構有相同的深度.
使用Patch命令
patch -p0 < new-patch
patch -p1 < new-patch
這兩個命令的差異在於目前工作目錄的不同
另外一種用法是讓patch 從標準輸入讀取資料:
cat new-patch | patch -p0
還有一種用法是讓patch 讀取 "here document"的方式
( 省略此種方法之舉例 )
Patch指令的階層 ( -p0 和 -p1 的差別 )
假設patch的表頭如下
— old/modules/pcitable Mon Sep 27 11:03:56 1999
+++ new/modules/pcitable Tue Dec 19 20:05:41 2000
使用 -p0 , patch會期待在你目前的工作目錄下有一個名為new的目錄, 接著會有modules目錄, 然後是pictable目錄
使用 -p1 , 路徑的第一層會被拿掉, 也就是patch期待工作目錄下有 modules目錄, 然後是pictable目錄
-p2, -p3, …. 以此類推
Patch使用方法
Patch表頭
開頭是 —, +++, 並且接著被比較的檔案
同個patch檔包含多個patch
瀏覽patch檔的方法
less /tmp/file-patch
/—
n
n
n
( /— 會搜尋—,而n會搜尋下個出現的— )
Hunk
每個patch的段落稱作 Hunk,每個段落皆以兩個老鼠記號 ( @@ ) 開始, 直至下個段落開始,或者下個patch header為止
Howto apply a patch file to my Linux / UNIX source code
http://www.cyberciti.biz/faq/appy-patch-file-using-patch-command/
Q.I know that I can patch binary package using up2date or yum command in Linux but what I’m wondering is if there’s a way to apply a patch file to downloaded source code under Linux / UNIX like operating system source tree?
A. Linux and UNIX source software often comes with security and other patches. You can download them from Internet or project home page. There is a command called patch that apply a diff file or patch to an original source tree.
patch takes a patch file patchfile containing a difference listing produced by the diff program and applies those differences to one or more original files, producing patched versions. Normally the patched versions are put in place of the originals.
The following usage is most commonly used:
$ patch -p1 < {/path/to/patch/file}
To apply a patch, one could run the following command in a shell:
$ patch < /path/to/file
Patches can be undone, or reversed, with the ‘-R’ option:
$ patch -R < /path/to/file
Above 3 are basic usage read the man page of patch command for more information and usage:
% man patch