Index: pgadmin/include/utils/sysSettings.h
===================================================================
--- pgadmin/include/utils/sysSettings.h	(revision 7164)
+++ pgadmin/include/utils/sysSettings.h	(working copy)
@@ -98,6 +98,12 @@
     long GetIndentSpaces() const { return indentSpaces; }
     void SetIndentSpaces(long l) { indentSpaces=l; }
 
+    bool GetLineNumbersUniversal() const { return displayLineNumbersUniversal; }
+    void SetLineNumbersUniversal(bool lnu) { displayLineNumbersUniversal=lnu; }
+
+    bool GetLineNumbersQuery() const { return displayLineNumbersQuery; }
+    void SetLineNumbersQuery(bool lnq) { displayLineNumbersQuery=lnq; }
+
     bool GetSpacesForTabs() const { return spacesForTabs; }
     void SetSpacesForTabs(const bool newval) { spacesForTabs = newval; }
 
@@ -223,6 +229,7 @@
     long maxRows, maxColSize, autoRowCountThreshold, indentSpaces;
     bool spacesForTabs, stickySql, indicateNull, unicodeFile, tabForCompletion;
     bool doubleClickProperties;
+    bool displayLineNumbersUniversal, displayLineNumbersQuery;
     long maxServerLogSize;
 
     wxString searchPath, systemSchemas;
Index: pgadmin/frm/frmOptions.cpp
===================================================================
--- pgadmin/frm/frmOptions.cpp	(revision 7164)
+++ pgadmin/frm/frmOptions.cpp	(working copy)
@@ -61,6 +61,8 @@
 #define txtAutoRowCount             CTRL_TEXT("txtAutoRowCount")
 #define txtIndent                   CTRL_TEXT("txtIndent")
 #define chkSpacesForTabs			CTRL_CHECKBOX("chkSpacesForTabs")
+#define chkLineNumbersQuery			CTRL_CHECKBOX("chkLineNumbersQuery")
+#define chkLineNumbersUniversal		CTRL_CHECKBOX("chkLineNumbersUniversal")
 #define cbCopyQuote					CTRL_COMBOBOX("cbCopyQuote")
 #define cbCopyQuoteChar				CTRL_COMBOBOX("cbCopyQuoteChar")
 #define cbCopySeparator				CTRL_COMBOBOX("cbCopySeparator")
@@ -125,7 +127,9 @@
     chkShowUsersForPrivileges->SetValue(settings->GetShowUsersForPrivileges());
     txtAutoRowCount->SetValue(NumToStr(settings->GetAutoRowCountThreshold()));
     txtIndent->SetValue(NumToStr(settings->GetIndentSpaces()));
-    chkSpacesForTabs->SetValue(settings->GetSpacesForTabs());
+    chkLineNumbersUniversal->SetValue(settings->GetLineNumbersUniversal());
+	chkLineNumbersQuery->SetValue(settings->GetLineNumbersQuery());
+	chkSpacesForTabs->SetValue(settings->GetSpacesForTabs());
 	cbCopyQuote->SetSelection(settings->GetCopyQuoting());
 	cbCopyQuoteChar->SetValue(settings->GetCopyQuoteChar());
 
@@ -358,6 +362,8 @@
     settings->SetAutoRowCountThreshold(StrToLong(txtAutoRowCount->GetValue()));
     settings->SetIndentSpaces(StrToLong(txtIndent->GetValue()));
     settings->SetSpacesForTabs(chkSpacesForTabs->GetValue());
+	settings->SetLineNumbersQuery(chkLineNumbersQuery->GetValue());
+	settings->SetLineNumbersUniversal(chkLineNumbersUniversal->GetValue());
 	settings->SetCopyQuoting(cbCopyQuote->GetCurrentSelection());
 	settings->SetCopyQuoteChar(cbCopyQuoteChar->GetValue());
 	
Index: pgadmin/frm/frmQuery.cpp
===================================================================
--- pgadmin/frm/frmQuery.cpp	(revision 7164)
+++ pgadmin/frm/frmQuery.cpp	(working copy)
@@ -303,7 +303,13 @@
     // Query box
     sqlQuery = new ctlSQLBox(this, CTL_SQLQUERY, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxSIMPLE_BORDER | wxTE_RICH2);
     sqlQuery->SetDatabase(conn);
-    sqlQuery->SetMarginWidth(1, 16);
+    
+    if (settings->GetLineNumbersQuery())
+    {
+        sqlQuery->SetMarginType(1, wxSTC_MARGIN_NUMBER);
+        sqlQuery->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);
+    }
+
     SetLineEndingStyle();
 
     // Results pane
Index: pgadmin/utils/sysSettings.cpp
===================================================================
--- pgadmin/utils/sysSettings.cpp	(revision 7164)
+++ pgadmin/utils/sysSettings.cpp	(working copy)
@@ -148,6 +148,8 @@
     showUsersForPrivileges=StrToBool(Read(wxT("ShowUsersForPrivileges"), wxT("No")));
     Read(wxT("AutoRowCount"), &autoRowCountThreshold, 2000L);
     Read(wxT("IndentSpaces"), &indentSpaces, 0L);
+    Read(wxT("DisplayLineNumbersUniversal"), &displayLineNumbersUniversal, true);
+    Read(wxT("DisplayLineNumbersQuery"), &displayLineNumbersQuery, false);
     Read(wxT("SpacesForTabs"), &spacesForTabs, false);
 	Read(wxT("TabForCompletion"), &tabForCompletion, false);
     Read(wxT("StickySql"), &stickySql, false);
@@ -434,6 +436,8 @@
     Write(wxT("PostgreSQLPath"), postgresqlPath);
     Write(wxT("EnterpriseDBPath"), enterprisedbPath);
     Write(wxT("IndentSpaces"), indentSpaces);
+    Write(wxT("DisplayLineNumbersUniversal"), displayLineNumbersUniversal);
+    Write(wxT("DisplayLineNumbersQuery"), displayLineNumbersQuery);
     Write(wxT("SpacesForTabs"), spacesForTabs);
 	Write(wxT("TabForCompletion"), tabForCompletion);
 
Index: pgadmin/dlg/dlgFunction.cpp
===================================================================
--- pgadmin/dlg/dlgFunction.cpp	(revision 7164)
+++ pgadmin/dlg/dlgFunction.cpp	(working copy)
@@ -117,8 +117,11 @@
 
     txtArguments->Disable();
 
-    txtSqlBox->SetMarginType(1, wxSTC_MARGIN_NUMBER);
-    txtSqlBox->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);
+    if (settings->GetLineNumbersUniversal())
+    {
+        txtSqlBox->SetMarginType(1, wxSTC_MARGIN_NUMBER);
+        txtSqlBox->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);
+    }
 
     btnAdd->Disable();
     btnRemove->Disable();
Index: pgadmin/dlg/dlgPackage.cpp
===================================================================
--- pgadmin/dlg/dlgPackage.cpp	(revision 7164)
+++ pgadmin/dlg/dlgPackage.cpp	(working copy)
@@ -43,11 +43,14 @@
     schema=sch;
     package=node;
 
-    txtHeader->SetMarginType(1, wxSTC_MARGIN_NUMBER);
-    txtHeader->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);
+    if (settings->GetLineNumbersUniversal())
+    {
+        txtHeader->SetMarginType(1, wxSTC_MARGIN_NUMBER);
+        txtHeader->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);
 
-    txtBody->SetMarginType(1, wxSTC_MARGIN_NUMBER);
-    txtBody->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);
+        txtBody->SetMarginType(1, wxSTC_MARGIN_NUMBER);
+        txtBody->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);
+    }
 }
 
 
Index: pgadmin/dlg/dlgTrigger.cpp
===================================================================
--- pgadmin/dlg/dlgTrigger.cpp	(revision 7164)
+++ pgadmin/dlg/dlgTrigger.cpp	(working copy)
@@ -62,8 +62,11 @@
     table=parentNode;
     wxASSERT(!table || table->GetMetaType() == PGM_TABLE);
 
-    txtBody->SetMarginType(1, wxSTC_MARGIN_NUMBER);
-    txtBody->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);
+    if (settings->GetLineNumbersUniversal())
+    {
+        txtBody->SetMarginType(1, wxSTC_MARGIN_NUMBER);
+        txtBody->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);
+    }
 }
 
 
Index: pgadmin/ui/frmOptions.xrc
===================================================================
--- pgadmin/ui/frmOptions.xrc	(revision 7164)
+++ pgadmin/ui/frmOptions.xrc	(working copy)
@@ -150,6 +150,11 @@
             <pos>5,97d</pos>
             <size>226,12d</size>
           </object>
+          <object class="wxCheckBox" name="chkLineNumbersUniversal">
+            <label>Display Line Numbers Universally (unless specifically disabled)</label>
+            <pos>5,109d</pos>
+            <size>226,12d</size>
+          </object>
         </object>
       </object>
       <object class="notebookpage">
@@ -286,6 +291,16 @@
             <pos>175,172d</pos>
             <size>226,12d</size>
           </object>
+          <object class="wxStaticText" name="stLineNumbersQuery">
+            <label>Show Line Numbers in Query</label>
+            <pos>5,187d</pos>
+          </object>
+          <object class="wxCheckBox" name="chkLineNumbersQuery">
+            <label></label>
+            <checked>0</checked>
+            <pos>175,187d</pos>
+            <size>226,12d</size>
+          </object>
         </object>
       </object>
       <object class="notebookpage">